/* NOVA System styles - extracted safely from original HTML. */
:root {
      --bg-1: #05070f;
      --bg-2: #0b1324;
      --bg-3: #111b31;
      --surface: rgba(14, 20, 36, 0.72);
      --surface-strong: rgba(18, 24, 42, 0.92);
      --surface-soft: rgba(255, 255, 255, 0.05);
      --surface-border: rgba(255, 255, 255, 0.11);
      --text: #f4f7fb;
      --text-soft: rgba(244, 247, 251, 0.72);
      --accent: #ff4b57;
      --accent-soft: rgba(255, 75, 87, 0.17);
      --accent-2: #ff885d;
      --success: #32d289;
      --success-soft: rgba(50, 210, 137, 0.18);
      --warning: #ffb347;
      --warning-soft: rgba(255, 179, 71, 0.18);
      --danger: #ff737d;
      --danger-soft: rgba(255, 115, 125, 0.18);
      --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
      --radius-xl: 28px;
      --radius-lg: 20px;
      --radius-md: 16px;
      --radius-sm: 12px;
      --input-bg: rgba(255, 255, 255, 0.05);
      --grid-line: rgba(255, 255, 255, 0.04);
      --transition: 0.24s ease;
    }
    * {
      box-sizing: border-box;
    }
    html,
    body {
      min-height: 100%;
    }
    body {
      margin: 0;
      font-family: "DIN Next Arabic", "Outfit", "Segoe UI", Tahoma, sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at top right, rgba(255, 71, 87, 0.2), transparent 28%),
        radial-gradient(circle at 10% 20%, rgba(255, 121, 85, 0.12), transparent 22%),
        linear-gradient(135deg, var(--bg-1), var(--bg-2) 48%, var(--bg-3));
      padding: 24px;
      position: relative;
      overflow-x: hidden;
    }
    body.modal-open {
      overflow: hidden;
    }
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      background:
        linear-gradient(transparent 96%, var(--grid-line) 97%),
        linear-gradient(90deg, transparent 96%, var(--grid-line) 97%);
      background-size: 120px 120px;
      mask-image: radial-gradient(circle at center, black 40%, transparent 95%);
      pointer-events: none;
      opacity: 0.6;
    }
    button,
    input,
    select,
    textarea {
      font: inherit;
    }
    button {
      cursor: pointer;
    }
    img {
      display: block;
      max-width: 100%;
    }
    .hidden {
      display: none !important;
    }
    .hidden-panel {
      display: none !important;
    }
    .glass-card,
    .glass-section {
      background: var(--surface);
      backdrop-filter: blur(22px);
      -webkit-backdrop-filter: blur(22px);
      border: 1px solid var(--surface-border);
      box-shadow: var(--shadow);
    }
    .app-shell {
      max-width: 1500px;
      margin: 0 auto;
      display: grid;
      gap: 12px;
      padding-top: 168px;
    }
    .app-header {
      border-radius: var(--radius-xl);
      padding: 20px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      position: fixed;
      top: 16px;
      left: 50%;
      transform: translateX(-50%);
      width: min(1500px, calc(100vw - 48px));
      z-index: 20;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 18px;
      min-width: 0;
    }
    .brand-copy {
      direction: ltr;
      text-align: left;
      min-width: 0;
    }
    .brand-eyebrow,
    .section-eyebrow {
      margin: 0 0 6px;
      font-size: 12px;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: rgba(255, 122, 110, 0.8);
    }
    .brand-copy h1 {
      margin: 0;
      font-size: clamp(22px, 2.6vw, 32px);
      line-height: 1.05;
      letter-spacing: -0.03em;
    }
    .brand-subtitle {
      margin: 4px 0 0;
      color: var(--text-soft);
      font-size: 13px;
      letter-spacing: 0.02em;
    }
    .brand-logo-shell,
    .login-logo-shell {
      position: relative;
      width: 136px;
      aspect-ratio: 1;
      border-radius: 18px;
      display: grid;
      place-items: center;
      background: transparent;
      border: 1px solid rgba(255, 95, 110, 0.2);
      box-shadow:
        0 0 24px rgba(255, 64, 82, 0.18),
        0 18px 40px rgba(0, 0, 0, 0.35);
      overflow: hidden;
      isolation: isolate;
      padding: 0;
    }
    .login-logo-shell {
      width: 132px;
      margin: 0 auto 18px;
      border-radius: 36px;
    }
    .brand-logo-shell::before,
    .login-logo-shell::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: 24px;
      background: radial-gradient(circle, rgba(255, 74, 96, 0.24), transparent 68%);
      filter: blur(10px);
      animation: glowPulse 3.4s ease-in-out infinite;
      z-index: 0;
    }
    .brand-logo-shell::after,
    .login-logo-shell::after {
      content: "";
      position: absolute;
      inset: -12%;
      border-radius: 40px;
      background: radial-gradient(circle, rgba(255, 64, 82, 0.24), transparent 68%);
      filter: blur(16px);
      opacity: 0.95;
      z-index: 0;
    }
    .brand-logo-image,
    .login-logo-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      filter:
        drop-shadow(0 0 10px rgba(255, 74, 96, 0.34))
        drop-shadow(0 0 26px rgba(255, 74, 96, 0.16));
      position: relative;
      z-index: 1;
      animation: logoFloat 4.8s ease-in-out infinite;
    }
    .toolbar-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 10px;
    }
    .btn {
      border: 0;
      border-radius: 999px;
      padding: 9px 14px;
      min-height: 38px;
      color: var(--text);
      background: linear-gradient(135deg, rgba(255, 79, 92, 0.94), rgba(255, 130, 93, 0.86));
      box-shadow:
        0 8px 22px rgba(255, 82, 96, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
      transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), background var(--transition);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-decoration: none;
      white-space: nowrap;
    }
    .btn:hover:not(:disabled) {
      transform: translateY(-2px);
      box-shadow:
        0 12px 26px rgba(255, 82, 96, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }
    .btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      box-shadow: none;
    }
    .btn.secondary,
    .btn.ghost {
      background: rgba(255, 255, 255, 0.07);
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-shadow: none;
    }
    .btn.secondary:hover:not(:disabled),
    .btn.ghost:hover:not(:disabled) {
      background: rgba(255, 255, 255, 0.12);
    }
    .btn.success {
      background: linear-gradient(135deg, rgba(42, 191, 118, 0.94), rgba(70, 222, 170, 0.82));
      box-shadow: 0 10px 24px rgba(42, 191, 118, 0.28);
    }
    .btn.danger {
      background: linear-gradient(135deg, rgba(255, 95, 110, 0.92), rgba(187, 44, 74, 0.92));
      box-shadow: 0 10px 24px rgba(255, 72, 102, 0.24);
    }
    .btn.is-busy {
      pointer-events: none;
    }
    .spinner {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 2px solid rgba(255, 255, 255, 0.26);
      border-top-color: #fff;
      animation: spin 0.7s linear infinite;
    }
    .app-grid {
      display: grid;
      grid-template-columns: 380px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
      min-height: calc(100vh - 116px);
    }
    .sidebar,
    .overview {
      border-radius: 22px;
      padding: 12px;
    }
    .sidebar {
      position: sticky;
      top: 88px;
      display: grid;
      gap: 10px;
      max-height: calc(100vh - 100px);
      overflow: auto;
      align-content: start;
    }
    .section-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 14px;
    }
    .section-heading.compact {
      margin-bottom: 12px;
    }
    .section-heading h2,
    .section-heading h3,
    .overview-top h2 {
      margin: 0;
      font-size: 18px;
      line-height: 1.1;
    }
    .section-heading p,
    .overview-top p,
    .sidebar-note,
    .helper-text {
      margin: 6px 0 0;
      color: var(--text-soft);
      font-size: 14px;
    }
    .po-grid,
    .items-grid {
      display: grid;
      gap: 8px;
    }
    .po-grid {
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      align-content: start;
    }
    .po-card {
      min-height: 72px;
      border-radius: var(--radius-md);
      border: 1px solid rgba(255, 255, 255, 0.09);
      padding: 10px 10px;
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)),
        rgba(0, 0, 0, 0.18);
      display: grid;
      gap: 8px;
      text-align: right;
      cursor: pointer;
      transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
      color: var(--text);
    }
    .po-card:hover {
      transform: translateY(-2px);
      border-color: rgba(255, 99, 113, 0.24);
      box-shadow: 0 14px 26px rgba(0, 0, 0, 0.22);
    }
    .po-card.is-active {
      border-color: rgba(255, 92, 107, 0.42);
      background:
        linear-gradient(180deg, rgba(255, 95, 110, 0.16), rgba(255, 255, 255, 0.04)),
        rgba(0, 0, 0, 0.28);
      box-shadow: 0 18px 36px rgba(255, 72, 102, 0.14);
    }
    .po-card-top,
    .item-card-top {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: flex-start;
    }
    .po-title,
    .item-name {
      font-size: 18px;
      font-weight: 700;
      word-break: break-word;
    }
    .po-card small,
    .meta-pill,
    .item-id {
      color: var(--text-soft);
      font-size: 12px;
    }
    .po-actions,
    .item-actions {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }
    .icon-btn {
      width: 34px;
      height: 34px;
      border-radius: 999px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      background: rgba(255, 255, 255, 0.06);
      color: var(--text);
      display: inline-grid;
      place-items: center;
      transition: background var(--transition), transform var(--transition), border-color var(--transition);
    }
    .icon-btn:hover {
      background: rgba(255, 255, 255, 0.12);
      transform: translateY(-1px);
    }
    .icon-btn.danger:hover {
      background: rgba(255, 95, 110, 0.18);
      border-color: rgba(255, 95, 110, 0.36);
    }
    .overview {
      display: grid;
      gap: 8px;
      height: calc(100vh - 170px);
      max-height: calc(100vh - 170px);
      overflow: hidden;
    }
    .overview-top {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
      padding-bottom: 6px;
    }
    .overview-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
      gap: 8px;
    }
    .stat-card {
      padding: 12px 14px;
      border-radius: var(--radius-md);
      border: 1px solid rgba(255, 255, 255, 0.08);
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        rgba(0, 0, 0, 0.18);
      min-height: 92px;
      display: grid;
      align-content: space-between;
      gap: 8px;
    }
    .stat-value {
      font-size: clamp(22px, 2.2vw, 30px);
      font-weight: 800;
      letter-spacing: -0.03em;
    }
    .stat-label {
      color: var(--text-soft);
      font-size: 11px;
    }
    .accent-text {
      background: linear-gradient(135deg, #ff7781, #ffd1af);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
    }
    .glass-section {
      border-radius: var(--radius-lg);
      padding: 18px;
    }
    .po-note-input,
    .field-input,
    .field-textarea,
    .shortage-input,
    .field-select {
      width: 100%;
      border-radius: 14px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      background: var(--input-bg);
      color: var(--text);
      padding: 13px 14px;
      transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    }
    .po-note-input,
    .field-textarea {
      min-height: 110px;
      resize: vertical;
    }
    .field-input:focus,
    .field-textarea:focus,
    .shortage-input:focus,
    .field-select:focus,
    .po-note-input:focus {
      outline: none;
      border-color: rgba(255, 115, 125, 0.45);
      box-shadow: 0 0 0 3px rgba(255, 115, 125, 0.14);
      background: rgba(255, 255, 255, 0.07);
    }
    .data-center {
      display: grid;
      gap: 16px;
    }
    .data-actions,
    .backup-settings-grid,
    .meta-row,
    .summary-row {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }
    .meta-row {
      gap: 8px;
    }
    .meta-chip,
    .status-pill,
    .progress-badge,
    .summary-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.08);
      font-size: 12px;
      color: var(--text);
    }
    .status-pill.shortage {
      background: var(--warning-soft);
      border-color: rgba(255, 179, 71, 0.22);
      color: #ffd59a;
    }
    .status-pill.success {
      background: var(--success-soft);
      border-color: rgba(50, 210, 137, 0.22);
      color: #bdf4d9;
    }
    .status-pill.quality {
      background: rgba(115, 177, 255, 0.18);
      border-color: rgba(115, 177, 255, 0.24);
      color: #cce0ff;
    }
    .status-pill.neutral {
      color: var(--text-soft);
    }
    .items-grid {
      grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
      align-content: start;
    }
    #poContent {
      display: grid;
      grid-template-rows: auto auto auto minmax(0, 1fr);
      gap: 8px;
      min-height: 0;
      overflow: hidden;
    }
    #itemsSection {
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }
    #itemsList {
      flex: 1;
      overflow: auto;
      padding-inline-end: 6px;
      align-content: start;
    }
    .item-card {
      border-radius: 16px;
      padding: 10px 10px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        rgba(0, 0, 0, 0.2);
      display: grid;
      gap: 8px;
      transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    }
    .item-card:hover {
      transform: translateY(-3px);
      border-color: rgba(255, 110, 122, 0.24);
      box-shadow: 0 18px 30px rgba(0, 0, 0, 0.22);
    }
    .item-card.is-shortage {
      border-color: rgba(255, 179, 71, 0.24);
    }
    .item-card.is-complete {
      border-color: rgba(50, 210, 137, 0.24);
    }
    .item-name-wrap {
      min-width: 0;
      display: grid;
      gap: 6px;
    }
    .progress-badge {
      font-weight: 700;
      min-width: 68px;
      justify-content: center;
      background: rgba(255, 255, 255, 0.09);
      cursor: pointer;
      user-select: none;
    }
    .progress-badge.low {
      color: #ffd3a8;
      background: rgba(255, 165, 89, 0.16);
    }
    .progress-badge.mid {
      color: #fff2b7;
      background: rgba(237, 198, 88, 0.16);
    }
    .progress-badge.high {
      color: #c6ffd8;
      background: rgba(50, 210, 137, 0.16);
    }
    .item-details {
      display: grid;
      gap: 8px;
      color: var(--text-soft);
      font-size: 13px;
    }
    .item-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .item-footer .item-actions {
      margin-inline-start: auto;
    }
    .empty-state {
      border: 1px dashed rgba(255, 255, 255, 0.14);
      border-radius: var(--radius-lg);
      padding: 30px;
      text-align: center;
      color: var(--text-soft);
      background: rgba(255, 255, 255, 0.03);
    }
    .empty-state strong {
      display: block;
      margin-bottom: 8px;
      color: var(--text);
      font-size: 18px;
    }
    .switch {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .switch input {
      appearance: none;
      width: 50px;
      height: 28px;
      border-radius: 999px;
      position: relative;
      background: rgba(255, 255, 255, 0.14);
      outline: none;
      transition: background var(--transition);
      cursor: pointer;
      margin: 0;
    }
    .switch input::before {
      content: "";
      position: absolute;
      top: 3px;
      right: 4px;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #fff;
      transition: transform var(--transition);
    }
    .switch input:checked {
      background: rgba(255, 100, 114, 0.8);
    }
    .switch input:checked::before {
      transform: translateX(-20px);
    }
    .backup-log-list {
      list-style: none;
      margin: 0;
      padding: 0;
      display: grid;
      gap: 10px;
      max-height: 240px;
      overflow: auto;
    }
    .backup-log-item {
      padding: 12px 14px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.07);
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: flex-start;
    }
    .backup-log-item time {
      color: var(--text-soft);
      font-size: 12px;
      white-space: nowrap;
    }
    .modal-root {
      position: fixed;
      inset: 0;
      z-index: 40;
      pointer-events: none;
    }
    .modal-root > * {
      pointer-events: auto;
    }
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(2, 5, 12, 0.72);
      display: grid;
      place-items: center;
      padding: 24px;
      animation: fadeIn 0.22s ease;
    }
    .modal-card {
      width: min(1120px, 100%);
      max-height: min(92vh, 980px);
      overflow: hidden;
      border-radius: 18px;
      background: var(--surface-strong);
      border: 1px solid rgba(255, 255, 255, 0.11);
      box-shadow: 0 34px 80px rgba(0, 0, 0, 0.55);
      display: grid;
      grid-template-rows: auto 1fr;
      animation: modalUp 0.22s ease;
    }
    .modal-header {
      padding: 22px 24px 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      display: flex;
      justify-content: space-between;
      gap: 16px;
      align-items: flex-start;
      position: sticky;
      top: 0;
      background: rgba(17, 24, 42, 0.94);
      z-index: 2;
    }
    .modal-header h3 {
      margin: 0;
      font-size: 28px;
    }
    .modal-subtitle {
      margin: 6px 0 0;
      color: var(--text-soft);
      font-size: 14px;
    }
    .modal-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .modal-body {
      padding: 20px 24px 26px;
      overflow: auto;
      display: grid;
      gap: 18px;
    }
    .detail-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
    }
    .field-group {
      display: grid;
      gap: 8px;
    }
    .field-group label,
    .field-label {
      font-size: 13px;
      color: var(--text-soft);
    }
    .field-group.full {
      grid-column: 1 / -1;
    }
    .summary-card {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }
    .shortage-section {
      display: grid;
      gap: 8px;
    }
    .shortage-tools {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }
    .shortage-table-wrap {
      overflow: auto;
      border-radius: 18px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.03);
    }
    .shortage-table {
      width: 100%;
      min-width: 640px;
      border-collapse: collapse;
    }
    .shortage-table th,
    .shortage-table td {
      padding: 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.07);
      vertical-align: top;
      text-align: right;
    }
    .shortage-table th {
      position: sticky;
      top: 0;
      z-index: 1;
      background: rgba(26, 35, 58, 0.98);
      color: rgba(255, 244, 246, 0.92);
      font-weight: 600;
    }
    .shortage-row.completed {
      background: rgba(50, 210, 137, 0.07);
    }
    .shortage-row.completed .shortage-status {
      color: #baf2d4;
    }
    .shortage-row.completed .shortage-complete-target {
      background: rgba(50, 210, 137, 0.12);
      border-color: rgba(50, 210, 137, 0.3);
      color: #e8fff3;
    }
    .shortage-status {
      font-size: 12px;
      color: var(--text-soft);
      margin-top: 6px;
    }
    .prompt-card {
      width: min(520px, 100%);
    }
    .prompt-body {
      padding: 22px 24px 24px;
      display: grid;
      gap: 8px;
    }
    .toast-root {
      position: fixed;
      left: 20px;
      bottom: 20px;
      z-index: 70;
      display: grid;
      gap: 10px;
      max-width: min(380px, calc(100vw - 40px));
    }
    .toast {
      border-radius: 18px;
      padding: 14px 16px;
      background: rgba(13, 18, 33, 0.92);
      border: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 22px 40px rgba(0, 0, 0, 0.35);
      animation: toastIn 0.2s ease;
      color: var(--text);
    }
    .toast.success {
      border-color: rgba(50, 210, 137, 0.24);
    }
    .toast.error {
      border-color: rgba(255, 115, 125, 0.3);
    }
    .toast.info {
      border-color: rgba(255, 255, 255, 0.1);
    }
    .login-screen {
      min-height: calc(100vh - 48px);
      display: grid;
      place-items: center;
    }
    .login-card {
      width: min(480px, 100%);
      padding: 32px;
      border-radius: 34px;
      text-align: center;
    }
    .login-card h2 {
      margin: 0 0 10px;
      font-size: 32px;
    }
    .login-card p {
      margin: 0 0 24px;
      color: var(--text-soft);
    }
    .login-form {
      display: grid;
      gap: 8px;
      text-align: right;
    }
    .login-error {
      color: #ffc7cd;
      background: rgba(255, 73, 94, 0.12);
      border: 1px solid rgba(255, 115, 125, 0.16);
      border-radius: 14px;
      padding: 12px;
      font-size: 14px;
      display: none;
    }
    .login-error.visible {
      display: block;
    }
    .footer-note {
      text-align: center;
      color: var(--text-soft);
      font-size: 13px;
      padding-bottom: 4px;
    }
    @keyframes fadeIn {
      from {
        opacity: 0;
      }
      to {
        opacity: 1;
      }
    }
    @keyframes modalUp {
      from {
        opacity: 0;
        transform: translateY(16px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    @keyframes glowPulse {
      0%,
      100% {
        opacity: 0.62;
        transform: scale(0.96);
      }
      50% {
        opacity: 0.92;
        transform: scale(1.03);
      }
    }
    @keyframes logoFloat {
      0%,
      100% {
        transform: translateY(0);
      }
      50% {
        transform: translateY(-2px);
      }
    }
    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }
    @keyframes toastIn {
      from {
        opacity: 0;
        transform: translateY(8px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    #poContent {
      display: grid;
      gap: 10px;
      max-height: calc(100vh - 150px);
      overflow: hidden;
      grid-template-rows: auto auto auto 1fr;
    }
    #statsSection .stats-grid {
      margin-bottom: 0;
    }
    #itemsSection {
      display: grid;
      grid-template-rows: auto 1fr;
      min-height: 0;
      padding: 12px;
    }
    #itemsList {
      min-height: 0;
      max-height: 100%;
      overflow: auto;
      padding-inline-end: 4px;
    }
    .glass-section {
      border-radius: 16px;
      padding: 12px;
    }
    .data-center {
      display: grid;
    }
    .section-heading p,
    .overview-top p,
    .sidebar-note,
    .helper-text,
    .footer-note,
    .brand-eyebrow,
    .section-eyebrow {
      display: none !important;
    }
    .po-card small {
      font-size: 11px;
    }
    .po-title,
    .item-name {
      font-size: 15px;
    }
    .item-details {
      gap: 4px;
      font-size: 11px;
    }
    .item-details.compact {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }
    .settings-icon-btn {
      width: 38px;
      min-width: 38px;
      padding: 0;
      font-size: 18px;
      font-weight: 700;
    }
    .settings-panel {
      position: fixed;
      inset: 82px 18px 18px 18px;
      z-index: 55;
      display: grid;
      gap: 14px;
      overflow: auto;
      background: rgba(11, 16, 30, 0.82);
      border: 1px solid rgba(255,255,255,0.1);
      box-shadow: 0 28px 60px rgba(0,0,0,0.45);
      backdrop-filter: blur(26px);
      -webkit-backdrop-filter: blur(26px);
    }
    .settings-panel.hidden-panel {
      display: none;
    }
    .item-footer {
      gap: 8px;
    }
    .progress-badge {
      min-width: 54px;
      padding: 6px 10px;
      font-size: 11px;
    }
    .icon-btn {
      width: 28px;
      height: 28px;
    }
    .brand-logo-shell {
      background: transparent;
      border-color: rgba(255, 94, 108, 0.18);
      box-shadow: 0 0 24px rgba(255, 72, 102, 0.18);
    }
    .brand-logo-image {
      width: 100%;
      height: 100%;
      filter:
        drop-shadow(0 0 6px rgba(255, 74, 96, 0.28))
        drop-shadow(0 0 18px rgba(255, 74, 96, 0.16));
    }
    .toolbar-actions {
      gap: 8px;
    }
    .toolbar-actions .btn {
      font-size: 13px;
    }
    .sidebar .section-heading,
    #itemsSection .section-heading,
    .glass-section .section-heading {
      margin-bottom: 8px;
    }
    .sidebar::-webkit-scrollbar,
    .overview::-webkit-scrollbar,
    #itemsList::-webkit-scrollbar,
    .modal-body::-webkit-scrollbar,
    .shortage-table-wrap::-webkit-scrollbar {
      width: 12px;
      height: 12px;
    }
    .sidebar::-webkit-scrollbar-track,
    .overview::-webkit-scrollbar-track,
    #itemsList::-webkit-scrollbar-track,
    .modal-body::-webkit-scrollbar-track,
    .shortage-table-wrap::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.04);
      border-radius: 999px;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
      backdrop-filter: blur(8px);
    }
    .sidebar::-webkit-scrollbar-thumb,
    .overview::-webkit-scrollbar-thumb,
    #itemsList::-webkit-scrollbar-thumb,
    .modal-body::-webkit-scrollbar-thumb,
    .shortage-table-wrap::-webkit-scrollbar-thumb {
      border-radius: 999px;
      background:
        linear-gradient(180deg, rgba(255, 89, 103, 0.82), rgba(255, 145, 97, 0.56));
      border: 2px solid rgba(14, 20, 36, 0.6);
      box-shadow:
        0 0 10px rgba(255, 77, 94, 0.28),
        inset 0 0 8px rgba(255,255,255,0.12);
    }
    .sidebar,
    .overview,
    #itemsList,
    .modal-body,
    .shortage-table-wrap {
      scrollbar-width: thin;
      scrollbar-color: rgba(255, 89, 103, 0.85) rgba(255,255,255,0.05);
    }

    /* Professional compact UI adjustments */
    .app-shell { padding-top: 128px; }
    .app-header { padding: 10px 16px; min-height: 76px; }
    .brand-logo-shell { width: 84px; border-radius: 15px; }
    .brand-copy h1 { font-size: clamp(18px, 2vw, 24px); }
    .modal-overlay[data-modal-overlay="item"] .shortage-table-wrap {
      max-height: min(34vh, 320px);
      overflow: auto;
    }
    .toolbar-actions .btn, .overview-actions .btn { min-height: 32px; padding: 7px 11px; font-size: 12px; }
    .app-grid { min-height: calc(100vh - 104px); }
    .sidebar { top: 96px; max-height: calc(100vh - 112px); overflow-y: scroll; scrollbar-gutter: stable; }
    .po-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
    .po-card { min-height: 52px; padding: 8px; gap: 6px; }
    .po-title { font-size: 13px; }
    .po-select-check { width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
    .po-card.is-finished { opacity: 0.78; border-color: rgba(50, 210, 137, 0.22); }
    .finished-po-heading { margin-top: 8px; }
    .finished-po-grid:empty::before { content: "لا توجد أوردرات منتهية"; color: var(--text-soft); font-size: 12px; padding: 8px; display: block; }
    .compact-stats { grid-template-columns: repeat(7, minmax(105px, 1fr)); direction: rtl; }
    .stat-card { min-height: 58px; padding: 8px 10px; gap: 4px; }
    .stat-value { font-size: clamp(16px, 1.5vw, 22px); }
    .stat-label { font-size: 10px; line-height: 1.25; }
    .stat-card-button { color: var(--text); text-align: center; cursor: pointer; }
    .stat-card-button:hover { border-color: rgba(255, 115, 125, 0.38); transform: translateY(-1px); }
    .hidden-po-note { display: none !important; }
    .note-modal-card { width: min(560px, 100%); }
    .note-modal-card .field-textarea { min-height: 180px; }
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 6px; }
    .item-card { min-height: 76px; padding: 8px; gap: 6px; cursor: pointer; }
    .item-card.item-state-started { background: linear-gradient(180deg, rgba(255, 179, 71, 0.30), rgba(255, 179, 71, 0.12)), rgba(0,0,0,0.18); border-color: rgba(255, 179, 71, 0.48); }
    .item-card.item-state-shortage { background: linear-gradient(180deg, rgba(255, 95, 110, 0.34), rgba(255, 95, 110, 0.13)), rgba(0,0,0,0.2); border-color: rgba(255, 95, 110, 0.52); }
    .item-card.item-state-quality-shortage { background: linear-gradient(180deg, rgba(155, 89, 182, 0.38), rgba(155, 89, 182, 0.16)), rgba(0,0,0,0.2); border-color: rgba(155, 89, 182, 0.58); }
    .item-card.item-state-quality { background: linear-gradient(180deg, rgba(50, 210, 137, 0.32), rgba(50, 210, 137, 0.12)), rgba(0,0,0,0.18); border-color: rgba(50, 210, 137, 0.52); }
    .item-card .summary-row { display: none !important; }
    .item-name { font-size: 13px; line-height: 1.25; }
    .item-details.compact { font-size: 10px; }
    .progress-badge { min-width: 46px; padding: 5px 8px; font-size: 10px; }
    .field-input[type="number"], .shortage-input[type="number"], input[inputmode="numeric"] { max-width: 96px; padding: 8px 10px; text-align: center; }
    .modal-overlay[data-modal-overlay="item"] .detail-grid {
      grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
      align-items: end;
    }
    .modal-overlay[data-modal-overlay="item"] .field-group {
      width: fit-content;
      max-width: 100%;
    }
    .modal-overlay[data-modal-overlay="item"] .field-group.full {
      width: 100%;
    }
    .modal-overlay[data-modal-overlay="item"] .field-input,
    .modal-overlay[data-modal-overlay="item"] .field-select,
    .modal-overlay[data-modal-overlay="item"] .shortage-input {
      width: auto;
      min-width: 0;
      padding: 9px 11px;
    }
    .modal-overlay[data-modal-overlay="item"] input[data-item-field="name"] {
      width: clamp(220px, 30vw, 360px);
    }
    .modal-overlay[data-modal-overlay="item"] input[data-item-field="panelCount"],
    .modal-overlay[data-modal-overlay="item"] input[data-shortage-field="qty"] {
      width: 90px;
      text-align: center;
    }
    .modal-overlay[data-modal-overlay="item"] input[type="date"] {
      width: 150px;
    }
    .modal-overlay[data-modal-overlay="item"] input[data-item-field="technician"] {
      width: 180px;
    }
    .modal-overlay[data-modal-overlay="item"] textarea[data-item-field="notes"] {
      width: 100%;
      min-height: 82px;
    }
    .modal-overlay[data-modal-overlay="item"] input[data-shortage-field="missing"] {
      width: clamp(240px, 34vw, 420px);
    }
    .modal-overlay[data-modal-overlay="item"] .shortage-table th:nth-child(1),
    .modal-overlay[data-modal-overlay="item"] .shortage-table td:nth-child(1) { width: 50%; }
    .modal-overlay[data-modal-overlay="item"] .shortage-table th:nth-child(2),
    .modal-overlay[data-modal-overlay="item"] .shortage-table td:nth-child(2) { width: 110px; }
    .modal-overlay[data-modal-overlay="item"] .shortage-table th:nth-child(3),
    .modal-overlay[data-modal-overlay="item"] .shortage-table td:nth-child(3) { width: 170px; }
    .modal-overlay[data-modal-overlay="item"] .shortage-table th:nth-child(4),
    .modal-overlay[data-modal-overlay="item"] .shortage-table td:nth-child(4) { width: 76px; }


    /* Focused item-list refinement: auto-width cards + one-line labels + progress beside panel count */
    #itemsList.items-grid {
      display: flex;
      flex-wrap: wrap;
      align-content: flex-start;
      align-items: flex-start;
      gap: 6px;
    }
    #itemsList .item-card {
      width: fit-content;
      min-width: 136px;
      max-width: 100%;
      grid-template-rows: auto auto;
    }
    #itemsList .item-card-top {
      justify-content: flex-start;
      align-items: center;
      min-width: 0;
    }
    #itemsList .item-name-wrap {
      display: block;
      min-width: 0;
    }
    #itemsList .item-name {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: min(260px, calc(100vw - 96px));
    }
    #itemsList .item-details.compact {
      display: flex;
      flex-wrap: nowrap;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }
    #itemsList .meta-pill {
      white-space: nowrap;
      flex: 0 0 auto;
    }
    #itemsList .progress-badge {
      flex: 0 0 auto;
      min-width: auto;
      padding: 5px 8px;
    }
    #itemsList .item-footer {
      display: none;
    }
    @media (max-width: 760px) {
      #itemsList .item-card { max-width: 100%; }
      #itemsList .item-name { max-width: calc(100vw - 86px); }
    }
    @media (max-width: 1200px) { .compact-stats { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); } }
    @media (max-width: 760px) { .app-shell { padding-top: 146px; } .app-header { min-height: 92px; } .brand-logo-shell { width: 60px; } }

    @media (max-width: 1100px) {
      .app-grid {
        grid-template-columns: 1fr;
      }
      .sidebar {
        position: static;
      }
      .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }
    @media (max-width: 760px) {
      body {
        padding: 14px;
      }
      .app-shell {
        padding-top: 184px;
      }
      .app-header {
        width: calc(100vw - 28px);
        top: 10px;
      }
      .app-header,
      .sidebar,
      .overview,
      .glass-section,
      .login-card {
        padding: 18px;
      }
      .brand {
        width: 100%;
        align-items: flex-start;
      }
      .toolbar-actions,
      .overview-actions {
        width: 100%;
        justify-content: stretch;
      }
      .toolbar-actions .btn,
      .overview-actions .btn {
        flex: 1 1 150px;
      }
      .detail-grid {
        grid-template-columns: 1fr;
      }
      .modal-overlay {
        padding: 10px;
      }
      .modal-header,
      .modal-body {
        padding: 10px 10px;
      }
      .modal-header {
        flex-direction: column;
      }
      .modal-actions {
        width: 100%;
      }
      .modal-actions .btn {
        flex: 1 1 140px;
      }
      .shortage-table,
      .shortage-table thead,
      .shortage-table tbody,
      .shortage-table th,
      .shortage-table td,
      .shortage-table tr {
        display: block;
      }
      .shortage-table {
        min-width: 0;
      }
      .shortage-table thead {
        display: none;
      }
      .shortage-table tr {
        padding: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      }
      .shortage-table td {
        padding: 8px 0;
        border: 0;
      }
      .shortage-table td::before {
        content: attr(data-label);
        display: block;
        color: var(--text-soft);
        margin-bottom: 6px;
        font-size: 12px;
      }
    }
    @media print {
      @page {
        size: A4 landscape;
        margin: 10mm;
      }
      html,
      body {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
      }
      body {
        background: #ffffff;
        color: #111827;
        padding: 0;
      }
      body::before {
        display: none !important;
      }
      .no-print,
      .toast-root,
      .login-screen,
      .sidebar,
      body:not(.print-item-modal) .modal-overlay {
        display: none !important;
      }
      .glass-card,
      .glass-section,
      .stat-card,
      .item-card,
      .modal-card {
        background: #ffffff !important;
        color: #111827 !important;
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        backdrop-filter: none !important;
      }
      .brand-subtitle,
      .section-heading p,
      .helper-text,
      .item-details,
      .status-pill,
      .meta-pill,
      .meta-chip,
      .item-id,
      .footer-note,
      .backup-log-item time,
      .modal-subtitle,
      .field-label,
      .section-eyebrow,
      .brand-eyebrow {
        color: #4b5563 !important;
      }
      .accent-text {
        color: #111827 !important;
        background: none !important;
        -webkit-text-fill-color: initial !important;
      }
      .app-header {
        position: static;
      }
      .app-shell,
      .app-grid,
      .overview,
      #itemsList,
      .items-grid,
      .shortage-table-wrap {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
      }
      body.print-item-modal .app-shell {
        display: none !important;
      }
      body.print-item-modal .modal-overlay {
        position: static;
        background: #ffffff;
        padding: 0;
      }
      body.print-item-modal .modal-card,
      body.print-item-modal .modal-body {
        width: 100%;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        border: 0 !important;
      }
      body.print-item-modal .modal-header {
        position: static;
        background: #ffffff !important;
      }
      .shortage-table {
        page-break-inside: auto;
      }
      .shortage-table tr {
        page-break-inside: avoid;
        break-inside: avoid;
      }
      .shortage-table thead {
        display: table-header-group;
      }
      .shortage-input,
      .field-input,
      .field-textarea,
      .field-select,
      .po-note-input {
        background: #ffffff !important;
        color: #111827 !important;
        border: 1px solid #d1d5db !important;
      }
    }

/* NOVA v3 additive modules */
.wide-modal {
  width: min(1180px, calc(100vw - 32px));
}
.nova-table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.compact-table-search {
  max-width: 320px;
  min-height: 36px;
  padding-block: 7px;
}
.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.sortable-header::after {
  content: " ⇅";
  color: var(--text-soft);
  font-size: 11px;
}
.sortable-header[data-sort-direction="asc"]::after {
  content: " ↑";
  color: var(--accent-2);
}
.sortable-header[data-sort-direction="desc"]::after {
  content: " ↓";
  color: var(--accent-2);
}
.compact-number {
  max-width: 110px;
  text-align: center;
}
.drawing-preview-body {
  min-height: 70vh;
}
.drawing-preview-body iframe {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
}
.action-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.shortage-po-group {
  display: block;
  margin-bottom: 14px;
}
.shortage-po-group h3 {
  margin: 0 0 10px;
}
.shortage-po-group ul {
  margin: 6px 0 12px;
}
.shortage-po-group li {
  margin-bottom: 6px;
}
@media (max-width: 760px) {
  .wide-modal {
    width: calc(100vw - 18px);
  }
  .nova-table-tools {
    align-items: stretch;
  }
  .compact-table-search {
    max-width: none;
    width: 100%;
  }
}

/* Local users & permissions layer */
.user-session-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  font-size: 12px;
  direction: ltr;
}
.permissions-grid,
.users-permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.permission-card,
.user-management-card {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
}
.permission-card label,
.user-management-card label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
}
.user-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.permission-denied {
  opacity: 0.45;
  pointer-events: none;
}
.readonly-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 179, 71, 0.16);
  color: var(--warning);
  font-size: 12px;
  border: 1px solid rgba(255, 179, 71, 0.25);
}

/* Time & Shortage Analytics Dashboard - additive styles only */
.analytics-modal-card {
  width: min(1380px, 100%);
}
.analytics-dashboard {
  gap: 16px;
}
.analytics-filters,
.analytics-kpi-grid,
.analytics-chart-grid {
  display: grid;
  gap: 10px;
}
.analytics-filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.analytics-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.analytics-kpi-card,
.analytics-chart-card,
.analytics-table-section {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.16);
}
.analytics-kpi-card {
  padding: 14px;
  min-height: 86px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}
.analytics-kpi-value {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.analytics-kpi-label {
  color: var(--text-soft);
  font-size: 12px;
}
.analytics-chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.analytics-chart-card,
.analytics-table-section {
  padding: 14px;
}
.analytics-chart-card h4 {
  margin: 0 0 12px;
  font-size: 15px;
}
.analytics-bar-row {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}
.analytics-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--text-soft);
  font-size: 12px;
}
.analytics-bar-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-bar-meta strong {
  color: var(--text);
}
.analytics-bar-track {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.analytics-bar-track span {
  display: block;
  width: var(--analytics-bar-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 79, 92, 0.85), rgba(255, 130, 93, 0.8));
}
.analytics-table-section {
  display: grid;
  gap: 12px;
}
.analytics-table-section .section-heading {
  align-items: end;
}
.analytics-search {
  max-width: 260px;
}
.analytics-table tr.hidden {
  display: none;
}
.analytics-risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.07);
}
.analytics-risk-pill.high {
  color: #ffd4d8;
  background: rgba(255, 95, 110, 0.16);
  border-color: rgba(255, 95, 110, 0.3);
}
.analytics-risk-pill.medium {
  color: #ffe0a8;
  background: rgba(255, 179, 71, 0.16);
  border-color: rgba(255, 179, 71, 0.28);
}
.analytics-risk-pill.low {
  color: #c8f8df;
  background: rgba(50, 210, 137, 0.14);
  border-color: rgba(50, 210, 137, 0.26);
}
@media (max-width: 720px) {
  .analytics-table-section .section-heading {
    display: grid;
  }
  .analytics-search {
    max-width: 100%;
  }
}

/* Production Stock additions */
.material-stock-row,
.shortage-table tr.material-stock-row td {
  background: rgba(255, 75, 87, 0.23) !important;
  border-color: rgba(255, 75, 87, 0.62) !important;
  box-shadow: inset 4px 0 0 rgba(255, 75, 87, 0.95);
}
.material-stock-row input,
.material-stock-row select,
.shortage-table tr.material-stock-row input,
.shortage-table tr.material-stock-row select {
  border-color: rgba(255, 75, 87, 0.62) !important;
  background: rgba(255, 75, 87, 0.10) !important;
}
.stock-hit-badge {
  display: inline-flex;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff0f2;
  background: rgba(255, 75, 87, 0.38);
  border: 1px solid rgba(255, 75, 87, 0.7);
  font-size: 11px;
  font-weight: 800;
}
.production-stock-total-box {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}
.production-stock-table-wrap {
  min-height: 230px;
  max-height: min(44vh, 420px);
  overflow: auto;
}
.production-stock-table-wrap .shortage-table td {
  vertical-align: top;
}


/* Item delete action - added safely without changing stored data */
.item-delete-btn {
  min-height: 32px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1;
}

/* Dropdown readability fix - dark options, no data/storage changes */
select,
.field-select,
.shortage-input:is(select) {
  color-scheme: dark;
  background-color: rgba(14, 20, 36, 0.96) !important;
  color: var(--text) !important;
}
select option,
.field-select option,
.shortage-input:is(select) option {
  background: #101827 !important;
  color: #f4f7fb !important;
}
select option:checked,
select option:hover,
.field-select option:checked,
.field-select option:hover,
.shortage-input:is(select) option:checked,
.shortage-input:is(select) option:hover {
  background: #26344f !important;
  color: #ffffff !important;
}


/* Item TIME button style - matched to TIME Migration reference */
.item-time-toggle {
  min-height: 34px;
  padding: 7px 12px;
}
.item-time-toggle span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}


/* Item TIME dropdown inside Item modal - no popup */
.item-time-dropdown {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  animation: fadeIn 0.18s ease;
}
.item-time-dropdown.hidden {
  display: none !important;
}
.item-time-dropdown-table-wrap {
  margin-top: 2px;
}

/* Item Production TIME panel - offline latest */
.item-time-panel {
  display: grid;
  gap: 12px;
}
.item-time-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.item-time-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.item-time-chip {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  font-size: 12px;
}
.item-time-chip strong {
  color: var(--text);
  font-weight: 700;
  text-align: left;
  direction: ltr;
}
.item-time-chip.is-filled {
  border-color: rgba(50, 210, 137, 0.26);
  background: rgba(50, 210, 137, 0.1);
}
.item-time-chip.is-empty {
  border-color: rgba(255, 179, 71, 0.18);
}
.item-time-table input[type="datetime-local"] {
  min-width: 230px;
}
.item-time-apply-all-btn {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.item-time-row.completed td {
  background: rgba(50, 210, 137, 0.08);
}
.modal-card-wide {
  width: min(980px, calc(100vw - 32px));
}


/* PO workflow board + search / drag ordering */
.po-search-holder {
  min-width: 0;
  width: min(100%, 240px);
}
.po-search-input {
  min-height: 38px;
  padding: 9px 14px;
}
.po-workflow-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
}
.po-status-section {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  padding: 8px;
  display: grid;
  gap: 8px;
}
.po-status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.po-status-heading strong {
  min-width: 28px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-soft);
  font-size: 11px;
}
.po-status-dropzone {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 6px;
  min-height: 36px;
  border-radius: 14px;
  transition: background var(--transition), box-shadow var(--transition);
}
.po-status-dropzone.is-drag-over {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 115, 125, 0.28);
}
.po-status-production { border-color: rgba(50, 210, 137, 0.22); }
.po-status-out-of-warehouse { border-color: rgba(255, 179, 71, 0.22); }
.po-status-not-started { border-color: rgba(255, 255, 255, 0.1); }
.po-section-empty {
  grid-column: 1 / -1;
  color: var(--text-soft);
  font-size: 12px;
  padding: 8px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  text-align: center;
}
.po-card[draggable="true"] { cursor: grab; }
.po-card.is-dragging { opacity: 0.48; transform: scale(0.98); }
.po-card.is-drag-over { border-color: rgba(255, 115, 125, 0.52); box-shadow: 0 0 0 2px rgba(255, 115, 125, 0.14); }
.po-drag-handle {
  color: var(--text-soft);
  font-weight: 900;
  line-height: 1;
  align-self: flex-start;
  opacity: 0.72;
}

/* PO Status donut chart for analytics */
.analytics-donut-wrap {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.analytics-donut {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: conic-gradient(var(--donut-segments));
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 14px 28px rgba(0,0,0,0.24);
}
.analytics-donut::after {
  content: "";
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.analytics-donut strong,
.analytics-donut span {
  position: relative;
  z-index: 1;
}
.analytics-donut strong {
  font-size: 22px;
  line-height: 1;
}
.analytics-donut span {
  font-size: 10px;
  color: var(--text-soft);
  margin-top: 26px;
}
.analytics-donut-legend {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.analytics-donut-legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}
.analytics-donut-legend-row span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--legend-color);
}
.analytics-donut-legend-row em {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-donut-legend-row strong { color: var(--text); }
@media (max-width: 760px) {
  .analytics-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .analytics-donut-legend { width: 100%; }
}

/* PO card layout fix: keep order numbers readable inside workflow board */
.po-workflow-list .po-card {
  min-width: 0;
  overflow: hidden;
}
.po-workflow-list .po-card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "check title drag"
    "actions actions actions";
  align-items: center;
  gap: 6px;
}
.po-workflow-list .po-card-top > .po-select-check {
  grid-area: check;
  margin: 0;
}
.po-workflow-list .po-card-top > div:not(.po-actions) {
  grid-area: title;
  min-width: 0;
  width: 100%;
}
.po-workflow-list .po-card-top > .po-drag-handle {
  grid-area: drag;
  align-self: center;
}
.po-workflow-list .po-card-top > .po-actions {
  grid-area: actions;
  justify-content: center;
  width: 100%;
  margin-top: 2px;
}
.po-workflow-list .po-title {
  display: block;
  min-width: 0;
  width: 100%;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: center;
  line-height: 1.2;
}
.po-workflow-list .po-status-dropzone {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (max-width: 520px) {
  .po-workflow-list .po-status-dropzone {
    grid-template-columns: 1fr;
  }
}

/* PO card compact top controls: keep buttons above and order number below */
.po-workflow-list .po-card {
  padding: 8px 8px 9px;
  min-height: 74px;
}
.po-workflow-list .po-card-top {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  grid-template-areas:
    "check actions drag"
    "title title title" !important;
  align-items: center;
  justify-items: center;
  gap: 5px 6px;
}
.po-workflow-list .po-card-top > .po-select-check {
  grid-area: check;
  width: 16px;
  height: 16px;
  margin: 0;
}
.po-workflow-list .po-card-top > .po-drag-handle {
  grid-area: drag;
  width: 22px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  opacity: 0.72;
}
.po-workflow-list .po-card-top > .po-actions {
  grid-area: actions;
  width: auto;
  margin: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.po-workflow-list .po-card .icon-btn {
  width: 26px;
  height: 26px;
  min-width: 26px;
  font-size: 13px;
  line-height: 1;
}
.po-workflow-list .po-card-top > div:not(.po-actions) {
  grid-area: title;
  min-width: 0;
  width: 100%;
}
.po-workflow-list .po-title {
  margin-top: 2px;
  display: block;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: center;
  line-height: 1.2;
  font-size: 15px;
  font-weight: 800;
}

/* NOVA phased update: activity feed, TIME V2, accessory requests, time analysis */
.activity-feed {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.045);
  display: grid;
  gap: 8px;
}
.activity-feed-title {
  font-size: 12px;
  color: var(--text-soft);
  letter-spacing: .04em;
}
.activity-feed-item {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 12px;
}
.activity-feed-item time,
.activity-feed-empty {
  color: var(--text-soft);
  font-size: 11px;
}
.shortage-actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.accessory-request-btn,
.item-time-hold-btn,
.item-time-apply-all-btn {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}
.item-time-row.on-hold {
  background: rgba(255, 179, 71, 0.1);
}
.item-time-chip.is-hold {
  border-color: rgba(255,179,71,.35);
  background: rgba(255,179,71,.12);
}
.item-time-table th,
.item-time-table td {
  min-width: 120px;
}
.time-analysis-body {
  display: grid;
  gap: 14px;
}
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.time-bars {
  display: grid;
  gap: 10px;
}
.time-bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(140px, 2fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.time-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.time-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,79,92,.95), rgba(255,130,93,.88));
}

/* Accessory Requests manual rows - keeps add area visible without changing saved data */
.accessory-request-editor,
.accessory-request-list {
  display: grid;
  gap: 12px;
}
.accessory-request-table-wrap {
  max-height: 320px;
  overflow: auto;
}


/* Activity feed location fix: show selected PO changes inside the items dashboard, bottom-left */
#itemsSection {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.dashboard-activity-feed {
  width: min(440px, 100%);
  max-height: 190px;
  overflow: auto;
  margin-top: 10px;
  margin-right: auto;
  margin-left: 0;
  align-self: end;
  justify-self: end;
}

/* Activity feed compact button + detailed modal */
.dashboard-activity-feed {
  width: min(320px, 100%);
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.activity-log-mini-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: right;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}
.activity-log-mini-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255, 115, 125, 0.32);
  background: linear-gradient(135deg, rgba(255, 91, 106, 0.18), rgba(255, 255, 255, 0.055));
}
.activity-log-mini-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.activity-log-mini-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 115, 125, 0.16);
  flex: 0 0 auto;
}
.activity-log-mini-text {
  display: grid;
  gap: 2px;
}
.activity-log-mini-text strong {
  font-size: 13px;
}
.activity-log-mini-text small,
.activity-log-mini-latest {
  font-size: 11px;
  color: var(--text-soft);
}
.activity-log-mini-latest {
  margin-top: 8px;
  line-height: 1.5;
  padding-inline: 4px;
}
.activity-log-mini-latest span {
  color: rgba(244, 247, 251, 0.55);
}
.activity-log-detail-list {
  display: grid;
  gap: 12px;
  overflow: auto;
}
.activity-log-detail-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.activity-log-detail-head,
.activity-log-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.activity-log-detail-head time {
  margin-inline-start: auto;
  color: var(--text-soft);
  font-size: 12px;
}
.activity-log-detail-card h4 {
  margin: 0;
  font-size: 16px;
}
.activity-log-detail-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  direction: rtl;
  text-align: right;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 12px;
}

/* Activity log final layout: top dashboard button only, no inline comments */
.overview-actions .dashboard-activity-feed {
  width: auto;
  max-width: 240px;
  margin: 0;
  padding: 0;
  align-self: center;
  justify-self: auto;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.overview-actions .activity-log-mini-btn {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  gap: 8px;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.07);
}
.overview-actions .activity-log-mini-icon {
  width: 20px;
  height: 20px;
  font-size: 10px;
  color: #ffd2d7;
}
.overview-actions .activity-log-mini-text strong {
  font-size: 12px;
}
.overview-actions .activity-log-mini-text small {
  font-size: 10px;
}
.activity-log-mini-latest {
  display: none !important;
}
.activity-log-modal-card {
  width: min(1050px, 100%);
}
.activity-log-timeline {
  position: relative;
  display: grid;
  gap: 0;
  max-height: min(72vh, 760px);
  overflow: auto;
  padding: 24px 28px;
  background: rgba(255, 255, 255, 0.02);
}
.activity-log-timeline::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 28px;
  right: 37px;
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
}
.activity-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 22px;
}
.activity-timeline-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--text);
  border: 5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 4px rgba(255, 95, 110, 0.10);
}
.activity-timeline-content {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 0 8px 0 0;
}
.activity-timeline-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  font-size: 15px;
  line-height: 1.7;
}
.activity-timeline-main strong {
  color: #fff;
}
.activity-timeline-main small {
  color: var(--text-soft);
  font-size: 12px;
}
.activity-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}
.activity-timeline-meta span {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.activity-timeline-details {
  margin: 0;
  padding: 10px 20px 10px 12px;
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}
.activity-timeline-details li {
  padding-inline-start: 4px;
}


/* NOVA messages / client requests / expected finish / alerts additions */
.messages-top-btn,
#alertsBtn {
  position: relative;
}
.notification-badge {
  display: inline-flex;
  min-width: 20px;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 6px;
  margin-inline-start: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 0 3px rgba(255, 115, 125, 0.18);
}
.messages-top-btn.has-notification {
  box-shadow: 0 0 0 3px rgba(255, 115, 125, 0.16), 0 12px 26px rgba(255, 82, 96, 0.22);
}
.messages-modal-body,
.alerts-list {
  display: grid;
  gap: 14px;
}
.messages-list,
.expected-po-list,
.alerts-list {
  display: grid;
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
  padding-inline-end: 6px;
}
.message-log-item,
.alert-log-item,
.expected-po-row {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
}
.message-log-item.unread {
  border-color: rgba(255, 179, 71, 0.4);
  background: rgba(255, 179, 71, 0.12);
}
.message-log-head,
.alert-log-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}
.message-log-item p,
.alert-log-item p {
  margin: 6px 0;
  color: var(--text);
}
.expected-po-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.alert-log-item.red {
  border-color: rgba(255, 115, 125, 0.45);
  background: rgba(255, 115, 125, 0.12);
}
.alert-log-item.yellow {
  border-color: rgba(255, 179, 71, 0.45);
  background: rgba(255, 179, 71, 0.12);
}
.alert-log-item.acknowledged {
  opacity: 0.7;
}
@keyframes novaAlertPulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 115, 125, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 115, 125, 0.08); }
}
@keyframes novaAlertPulseYellow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 179, 71, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 179, 71, 0.08); }
}
#alertsBtn.alert-blink-red {
  background: linear-gradient(135deg, rgba(255, 95, 110, 0.94), rgba(187, 44, 74, 0.92));
  animation: novaAlertPulseRed 1.1s ease-in-out infinite;
}
#alertsBtn.alert-blink-yellow {
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.94), rgba(255, 130, 93, 0.86));
  animation: novaAlertPulseYellow 1.1s ease-in-out infinite;
}

/* User title and export/message refinements */
.user-title-input { min-width: 150px; }
.messages-top-btn option[value="__all__"] { font-weight: 700; }


/* Dynamic fixed-header spacing: prevents overlap on narrow screens without changing the header or buttons. */
.app-shell {
  padding-top: var(--nova-header-offset, 128px);
}
@media (max-width: 760px) {
  .app-shell {
    padding-top: var(--nova-header-offset, 184px);
  }
}


/* NOVA online authentication status */
.online-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}
.online-status-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}
.online-status-chip.is-online { color: #8ff0bf; background: rgba(50,210,137,.12); border-color: rgba(50,210,137,.25); }
.online-status-chip.is-offline { color: #ffd59a; background: rgba(255,179,71,.12); border-color: rgba(255,179,71,.25); }
.online-status-chip.is-local { color: #cce0ff; background: rgba(115,177,255,.12); border-color: rgba(115,177,255,.25); }
.online-status-chip.is-error { color: #ffb1b7; background: rgba(255,115,125,.12); border-color: rgba(255,115,125,.25); }
.online-status-chip.is-checking { color: var(--text-soft); }
@media (max-width: 720px) { .online-status-chip { width: 100%; justify-content: center; } }
