/* ============================================================================
 * APP THEME — brand overlay for the FloorManager app (Shift + Slate)
 *
 * Loaded AFTER styles.css to retheme without touching the base stylesheet.
 * Both themes live in this single file, scoped under :root[data-theme="..."].
 * The theme switcher in the topbar just toggles document.documentElement's
 * data-theme attribute. No stylesheet enable/disable juggling.
 *
 * The base styles.css uses these tokens:
 *   --ink (text) · --muted · --panel · --soft · --soft-2
 *   --accent · --accent-strong · --accent-glow · --accent-2 · --blue
 *   --warn · --danger · --ok
 * Hardcoded inky backgrounds (#050509, #111118, etc.) in styles.css are kept
 * intentionally — they already match the dark surface palette.
 * ============================================================================ */

/* ── Default & INDIGO SaaS Theme (Enterprise Light & Sleek — Linear/Stripe style) ── */
:root,
:root[data-theme="indigo"],
:root[data-theme="saas"] {
  --bg:            #f8fafc;
  --panel:         #ffffff;
  --soft:          #f1f5f9;
  --soft-2:        #e2e8f0;
  --border:        #e2e8f0;
  --line:          #e2e8f0;
  --ink:           #0f172a;
  --muted:         #64748b;
  --subtle:        #94a3b8;

  --accent:        #4f46e5;
  --accent-strong: #4338ca;
  --accent-2:      #6366f1;
  --accent-glow:   rgba(79, 70, 229, 0.25);
  --accent-soft:   rgba(79, 70, 229, 0.09);
  --accent-soft-2: rgba(79, 70, 229, 0.04);
  --accent-border: rgba(79, 70, 229, 0.22);
  --accent-on:     #ffffff;     /* crisp white text on primary indigo */

  --ok:            #059669;
  --warn:          #d97706;
  --danger:        #dc2626;
  --blue:          #4f46e5;

  --tag-ok-bg:         #ecfdf5;
  --tag-ok-border:     #a7f3d0;
  --tag-ok-color:      #065f46;

  --tag-warn-bg:       #fffbeb;
  --tag-warn-border:   #fde68a;
  --tag-warn-color:    #92400e;

  --tag-danger-bg:     #fef2f2;
  --tag-danger-border: #fecaca;
  --tag-danger-color:  #991b1b;

  --tag-running-bg:    #eef2ff;
  --tag-running-border:#c7d2fe;
  --tag-running-color: #4338ca;

  --shadow:        0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg:     0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* ── SHIFT Theme (Signal Orange Dark) ─────────────────────────────────────── */
:root[data-theme="shift"] {
  --bg:            #050509;
  --panel:         #111118;
  --soft:          #141418;
  --soft-2:        #18181f;
  --border:        rgba(255, 255, 255, 0.08);
  --line:          rgba(255, 255, 255, 0.08);
  --ink:           #e6e8eb;
  --muted:         #a1a6ad;

  --accent:        #ff6a00;
  --accent-strong: #ff6a00;
  --accent-2:      #ff8a3a;
  --accent-glow:   rgba(255, 106, 0, .35);
  --blue:          #ff6a00;
  --accent-soft:   rgba(255, 106, 0, .14);
  --accent-soft-2: rgba(255, 106, 0, .05);
  --accent-border: rgba(255, 106, 0, .30);
  --accent-on:     #050507;

  --warn:          #ffac6e;
  --danger:        #f87171;
  --ok:            #34d399;

  --tag-ok-bg:     rgba(52, 211, 153, .14);
  --tag-ok-border: rgba(52, 211, 153, .30);
  --tag-danger-bg: rgba(248, 113, 113, .14);
  --tag-danger-border: rgba(248, 113, 113, .30);
  --tag-warn-bg:   rgba(255, 172, 110, .12);
  --tag-warn-border: rgba(255, 172, 110, .30);
}

/* ── SLATE Theme (Steel Blue Dark) ────────────────────────────────────────── */
:root[data-theme="slate"] {
  --bg:            #0a0d14;
  --panel:         #111622;
  --soft:          #161d2b;
  --soft-2:        #1c2536;
  --border:        rgba(255, 255, 255, 0.08);
  --line:          rgba(255, 255, 255, 0.08);
  --ink:           #e6e8ec;
  --muted:         #98a0aa;

  --accent:        #60a5fa;
  --accent-strong: #3b82f6;
  --accent-2:      #93c5fd;
  --accent-glow:   rgba(96, 165, 250, .28);
  --blue:          #60a5fa;
  --accent-soft:   rgba(96, 165, 250, .14);
  --accent-soft-2: rgba(96, 165, 250, .05);
  --accent-border: rgba(96, 165, 250, .30);
  --accent-on:     #0c0f14;

  --warn:          #fcd34d;
  --danger:        #f87171;
  --ok:            #4ade80;

  --tag-ok-bg:     rgba(74, 222, 128, .14);
  --tag-ok-border: rgba(74, 222, 128, .30);
  --tag-danger-bg: rgba(248, 113, 113, .14);
  --tag-danger-border: rgba(248, 113, 113, .30);
  --tag-warn-bg:   rgba(252, 211, 77, .12);
  --tag-warn-border: rgba(252, 211, 77, .30);
}

/* ============================================================================
 * Below: structural rules that reference the tokens above.
 * Unscoped — they work for whichever theme is active.
 * ============================================================================ */

/* ── Type system ──────────────────────────────────────────────────────────── */
html, body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.011em;
}
h1, h2, h3, h4, .topbar h1, .view-title, .panel h2, .panel h3 {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.eyebrow,
.meta,
code, kbd, samp, pre,
input[type="number"] {
  font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;
}

/* ── Topbar & Headers ─────────────────────────────────────────────────────── */
.topbar {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow) !important;
  padding: 8px 16px !important;
  margin-bottom: 16px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-height: 52px !important;
  box-sizing: border-box !important;
}

.topbar-main-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  min-width: 0 !important;
}

.topbar-title-wrap {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  min-width: max-content !important;
}

.topbar-title-wrap .eyebrow {
  margin: 0 0 2px !important;
  line-height: 1.1 !important;
  font-size: 0.70rem !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

.topbar-title-wrap h1 {
  margin: 0 !important;
  line-height: 1.15 !important;
  font-size: 1.40rem !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
}

.topbar-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  margin-left: 12px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow: visible !important;
}

.topbar-actions::-webkit-scrollbar {
  display: none !important;
}

.topbar-actions > *,
.topbar-actions button,
.topbar-actions div {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.topbar-actions [hidden],
.topbar-actions .sync-badge[hidden],
.topbar-actions .license-badge[hidden],
.topbar-actions button[hidden],
.topbar-actions div[hidden] {
  display: none !important;
}


/* ── Dropdown Menus inside Topbar ────────────────────────────────────────── */
.topbar-actions #quick-add-menu-dropdown {
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  position: absolute !important;
  top: calc(100% + 6px) !important;
  right: 0 !important;
  z-index: 99999 !important;
  background: var(--panel, #16181c) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5) !important;
  padding: 6px 0 !important;
  min-width: 190px !important;
}
.topbar-actions #quick-add-menu-dropdown[hidden] {
  display: none !important;
}

.topbar-actions #quick-add-menu-dropdown .dropdown-item {
  height: auto !important;
  min-height: 34px !important;
  max-height: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  padding: 8px 14px !important;
  background: transparent !important;
  border: none !important;
  color: var(--ink) !important;
  font-size: 0.85rem !important;
  cursor: pointer !important;
}
.topbar-actions #quick-add-menu-dropdown .dropdown-item:hover {
  background: var(--soft) !important;
}

/* Ensure every single control in the topbar has identical 30px height and vertical alignment */
.topbar-actions .command-palette-trigger,
.topbar-actions #quick-add-menu-btn,
.topbar-actions .shift-status-pill,
.topbar-actions .shift-clock-btn,
.topbar-actions #quick-pin-switch-btn,
.topbar-actions .sync-badge,
.topbar-actions .license-badge,
.topbar-actions #show-shortcuts-btn,
.topbar-actions #camera-qr-btn,
.topbar-actions #notification-bell-btn,
.topbar-actions #lang-switcher,
.topbar-actions .operator-login,
.topbar-actions .topbar-clock-pill,
.topbar-actions #logout-user {
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: middle !important;
  margin: 0 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.topbar-actions .command-palette-trigger {
  width: auto !important;
  max-width: 110px !important;
  padding: 0 6px !important;
  font-size: 0.72rem !important;
  border-radius: 6px !important;
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  gap: 4px !important;
}

.topbar-actions .command-palette-trigger span {
  display: inline-block !important;
  max-width: 48px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.topbar-actions .command-palette-trigger:hover {
  color: var(--ink) !important;
  background: var(--soft-2) !important;
  border-color: var(--accent) !important;
}

.topbar-actions .command-palette-trigger kbd {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  font-size: 0.58rem !important;
  padding: 1px 3px !important;
  border-radius: 3px !important;
}

.topbar-actions #quick-add-menu-btn {
  padding: 0 7px !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  gap: 3px !important;
}

.topbar-actions #shift-attendance-container {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  height: 30px !important;
  margin: 0 !important;
}

.topbar-actions .shift-status-pill {
  padding: 0 6px !important;
  font-size: 0.70rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}

.topbar-actions .shift-clock-btn {
  padding: 0 7px !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
}

.topbar-actions #quick-pin-switch-btn {
  padding: 0 6px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}

.topbar-actions #show-shortcuts-btn,
.topbar-actions #camera-qr-btn,
.topbar-actions #notification-bell-btn {
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  padding: 0 !important;
  justify-content: center !important;
  border-radius: 5px !important;
  font-size: 12px !important;
}

.topbar-actions #lang-switcher {
  border-radius: 5px !important;
  overflow: hidden !important;
  height: 30px !important;
}

.topbar-actions #lang-switcher .theme-chip {
  height: 100% !important;
  padding: 0 4px !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: none !important;
  border-radius: 0 !important;
}

.topbar-actions .license-badge {
  min-width: 0 !important;
  max-width: 150px !important;
  padding: 0 8px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
  background: rgba(34, 197, 94, 0.08) !important;
  color: #86efac !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  cursor: help !important;
}

.topbar-actions .license-badge strong {
  color: #86efac !important;
  font-weight: 800 !important;
  letter-spacing: 0.03em !important;
  white-space: nowrap !important;
}

.topbar-actions .license-badge small {
  display: none !important;
}

.topbar-actions .operator-login {
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  border-radius: 999px !important;
  padding: 0 8px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  max-width: 130px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.topbar-actions .topbar-clock-pill {
  padding: 0 8px !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  gap: 4px !important;
}

.topbar-actions #logout-user {
  padding: 0 10px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  border-radius: 7px !important;
}

/* ── Theme & Language Switchers (topbar) ─────────────────────────────────── */
.theme-switcher,
.lang-switcher {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  border-radius: 999px;
}
.theme-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.theme-chip:hover { color: var(--ink); }
.theme-chip.active {
  background: var(--panel) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow) !important;
}
.theme-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}
.theme-dot-indigo { background: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,.22); }
.theme-dot-shift { background: #ff6a00; box-shadow: 0 0 0 2px rgba(255,106,0,.18); }
.theme-dot-slate { background: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,.18); }

/* ── Brand mark — chevron-F SVG container ────────────────────────────────── */
.brand-mark {
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%) !important;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.3) !important;
  border: none !important;
  padding: 0 !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}
.brand-mark svg {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
}
.brand-mark svg path {
  fill: #ffffff !important;
}
.brand-mark svg circle {
  fill: #ff6a00 !important;
}

.brand strong {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink) !important;
}
.brand span {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── Active nav item ─────────────────────────────────────────────────────── */
.nav-item {
  border-radius: 8px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.nav-item.active {
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
  box-shadow: inset 3px 0 0 var(--accent) !important;
  font-weight: 600 !important;
}
.nav-item.active svg { color: var(--accent) !important; }
.nav-item:hover:not(.active) { background: var(--soft) !important; color: var(--ink) !important; }
.nav-item:active { transform: scale(0.98); }

/* ── Primary & Text Action Buttons ────────────────────────────────────────── */
.primary-action,
button.primary-action,
button.primary,
.btn-primary {
  background: var(--accent) !important;
  color: var(--accent-on) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 8px !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  padding: 8px 16px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 16px var(--accent-glow) !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.primary-action:hover,
button.primary-action:hover,
button.primary:hover,
.btn-primary:hover {
  background: var(--accent-strong) !important;
  box-shadow: 0 4px 16px var(--accent-glow) !important;
  transform: translateY(-1px) !important;
  filter: brightness(1.05) !important;
}
.primary-action:active,
button.primary-action:active,
button.primary:active,
.btn-primary:active {
  transform: scale(0.97) translateY(0) !important;
  filter: brightness(0.95) !important;
}

.text-button,
button.text-button {
  background: var(--soft) !important;
  color: var(--ink) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
  font-size: 0.86rem !important;
  padding: 7px 14px !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.text-button:hover,
button.text-button:hover {
  background: var(--soft-2) !important;
  border-color: var(--border) !important;
  transform: translateY(-1px) !important;
  color: var(--ink) !important;
}
.text-button:active,
button.text-button:active {
  transform: scale(0.97) translateY(0) !important;
}

.icon-button {
  border-radius: 8px !important;
  border: 1px solid var(--border) !important;
  background: var(--soft) !important;
  color: var(--ink) !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.icon-button:hover {
  background: var(--soft-2) !important;
  transform: translateY(-1px) !important;
}
.icon-button:active {
  transform: scale(0.96) !important;
}

.command-palette-trigger {
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.84rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: all 0.15s ease !important;
}
.command-palette-trigger:hover {
  border-color: var(--accent-border) !important;
  color: var(--ink) !important;
}
.command-palette-trigger kbd {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  border-radius: 4px !important;
  padding: 2px 6px !important;
  font-size: 0.72rem !important;
}

.topbar-clock-pill {
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--ink) !important;
  border-radius: 999px !important;
  padding: 4px 10px !important;
  font-size: 0.80rem !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.15s ease !important;
}

.topbar-clock-pill:hover {
  background: var(--soft-2) !important;
  border-color: var(--subtle) !important;
}

.topbar-clock-pill .clock-digits {
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  color: var(--ink) !important;
  font-variant-numeric: tabular-nums !important;
}

.topbar-clock-pill .clock-ampm {
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}

.topbar-clock-pill .clock-tz-badge {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
  background: var(--tag-running-bg, #eef2ff) !important;
  border: 1px solid var(--tag-running-border, #c7d2fe) !important;
  border-radius: 4px !important;
  padding: 1px 5px !important;
  text-transform: uppercase !important;
}

.shift-status-pill {
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--ink) !important;
  border-radius: 999px !important;
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
}

.segmented button.active {
  background: var(--accent) !important;
  color: var(--accent-on) !important;
  font-weight: 600 !important;
}

/* ── Status tags & Pill Badges ────────────────────────────────────────────── */
.tag {
  font-family: 'Inter', -apple-system, sans-serif !important;
  font-size: 0.74rem !important;
  letter-spacing: 0.03em !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  border-radius: 9999px !important;
  padding: 3px 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.tag.running, .tag.warning {
  background: var(--tag-running-bg, #eef2ff) !important;
  color: var(--tag-running-color, #4338ca) !important;
  border: 1px solid var(--tag-running-border, #c7d2fe) !important;
}
.tag.planned {
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid var(--border) !important;
}
.tag.done {
  background: var(--tag-ok-bg, #ecfdf5) !important;
  color: var(--tag-ok-color, #065f46) !important;
  border: 1px solid var(--tag-ok-border, #a7f3d0) !important;
}
.tag.danger {
  background: var(--tag-danger-bg, #fef2f2) !important;
  color: var(--tag-danger-color, #991b1b) !important;
  border: 1px solid var(--tag-danger-border, #fecaca) !important;
}
.tag.hold {
  background: var(--tag-warn-bg, #fffbeb) !important;
  color: var(--tag-warn-color, #92400e) !important;
  border: 1px solid var(--tag-warn-border, #fde68a) !important;
}

.tag.priority-urgent {
  background: var(--tag-danger-bg, #fef2f2) !important;
  color: var(--tag-danger-color, #991b1b) !important;
  border-color: var(--tag-danger-border, #fecaca) !important;
}
.tag.priority-high {
  background: var(--tag-running-bg, #eef2ff) !important;
  color: var(--tag-running-color, #4338ca) !important;
  border-color: var(--tag-running-border, #c7d2fe) !important;
}
.tag.priority-low {
  background: transparent !important;
  color: var(--muted) !important;
  border-color: var(--border) !important;
}

/* ── Metric cards ────────────────────────────────────────────────────────── */
#dashboard-view .metric {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: var(--panel) !important;
  box-shadow: var(--shadow) !important;
  padding: 18px 20px !important;
  transition: transform 0.15s ease, border-color 0.15s ease !important;
}
#dashboard-view .metric:hover {
  transform: translateY(-2px) !important;
  border-color: var(--accent-border) !important;
}
#dashboard-view .metric strong {
  font-family: 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: 2.2rem !important;
  letter-spacing: -0.035em !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1 !important;
  color: var(--ink) !important;
}
#dashboard-view .metric span {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  margin-top: 8px !important;
  display: block !important;
}

.panel,
#dashboard-view .panel,
#schedule-view .machine-column,
.calendar-day,
.attention-card,
.bom-card,
.timer-card {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  background: var(--panel) !important;
  box-shadow: var(--shadow) !important;
}

/* ── Sync / license badges (top bar pills) ───────────────────────────────── */
.sync-badge {
  border-radius: 999px;
  padding: 5px 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .7rem;
  border: 1px solid var(--border);
  background: var(--soft);
}
.sync-badge strong { color: var(--ok); font-weight: 600; }
.license-badge strong { color: var(--accent-2); }
.sync-badge small { color: var(--muted); letter-spacing: .04em; }

/* ── Tables & Modern Row Contrast ────────────────────────────────────────── */
.data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
}

.data-table thead th {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--muted) !important;
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--soft) !important;
}

.data-table tbody td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--soft-2) !important;
  font-size: 0.88rem !important;
  color: var(--ink) !important;
  vertical-align: middle !important;
}

.data-table tbody tr {
  transition: background 0.15s ease, border-color 0.15s ease !important;
}

.data-table tbody tr:hover {
  background: var(--accent-soft-2) !important;
}

/* ── Inputs / focus / Modern Form Fields ─────────────────────────────────── */
input, select, textarea {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  font-family: 'Inter', sans-serif !important;
  padding: 8px 12px !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

input::placeholder, textarea::placeholder {
  color: var(--subtle, #94a3b8) !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

dialog.dialog {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ── Industry picker (was hardcoded blue) ────────────────────────────────── */
.industry-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft-2);
}
.industry-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ── Capacity / progress bars ────────────────────────────────────────────── */
.bar span { background: var(--accent); }
.bar span.warn { background: var(--warn); }
.bar span.danger { background: var(--danger); }

.capacity-row strong,
.scrap-wheel-value,
.dash-stat-num {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

/* ── Scrap dial ──────────────────────────────────────────────────────────── */
#dashboard-view .scrap-wheel {
  background: conic-gradient(var(--accent) calc(var(--scrap-pct, 0) * 1%), rgba(255,255,255,.06) 0) !important;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
* { scrollbar-color: rgba(255,255,255,.12) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; border: 3px solid #050509; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Selection ───────────────────────────────────────────────────────────── */
::selection { background: var(--accent-glow); color: #fff; }

/* ── Focus-visible (keyboard navigation) ─────────────────────────────────── */
.primary-action:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.nav-item:focus-visible,
.theme-chip:focus-visible {
  outline: 2px solid var(--accent, #ff6a00);
  outline-offset: 2px;
}

/* ── Status Select Badges & Sizing ───────────────────────────────────────── */
td select.status-select,
select.status-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  min-height: 28px !important;
  height: 28px !important;
  padding: 2px 24px 2px 10px !important;
  border-radius: 999px !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  outline: none !important;
  transition: all 0.15s ease !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 8px 5px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
  width: auto !important;
  min-width: 105px !important;
  max-width: 135px !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
}

select.status-select option {
  background-color: #171d26 !important;
  color: #e6e8eb !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.8rem !important;
  padding: 6px 12px !important;
}

/* Status-specific badge colors */
select.status-select-pending {
  background-color: #1e3a8a !important;
  color: #93c5fd !important;
  border: 1px solid #3b82f6 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 10 6'%3E%3Cpath fill='%2393c5fd' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 8px 5px !important;
}

select.status-select-running {
  background-color: #7c2d12 !important;
  color: #ffedd5 !important;
  border: 1px solid #f97316 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffedd5' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 8px 5px !important;
}

select.status-select-done {
  background-color: #064e3b !important;
  color: #a7f3d0 !important;
  border: 1px solid #10b981 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 10 6'%3E%3Cpath fill='%23a7f3d0' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 8px 5px !important;
}

select.status-select-hold {
  background-color: #713f12 !important;
  color: #fde68a !important;
  border: 1px solid #eab308 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 10 6'%3E%3Cpath fill='%23fde68a' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 8px 5px !important;
}

select.status-select:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

select.status-select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── Work Order Action Buttons in Tables ─────────────────────────────────── */
.data-table td .compact-button,
.data-table td .text-button {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  transition: all 0.12s ease;
}

.data-table td .compact-button:hover,
.data-table td .text-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ── Panel & Metric Card Aesthetics ──────────────────────────────────────── */
.panel, .metric, .attention-card, .bom-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel:hover, .attention-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── Topbar Command Palette Trigger ─────────────────────────────────────── */
.command-palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.command-palette-trigger:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent-border, rgba(255, 106, 0, 0.3));
  color: var(--ink);
  transform: translateY(-1px);
}
.command-palette-trigger kbd {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink);
}

/* ── Command Palette Overlay Modal ───────────────────────────────────────── */
.command-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 9, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  animation: paletteFadeIn 0.15s ease-out;
}

@keyframes paletteFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.command-palette-modal {
  width: min(640px, calc(100vw - 32px));
  background: var(--panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border, #e2e8f0);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.command-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--soft, #f8fafc);
}

.command-palette-header svg {
  color: var(--accent);
  flex-shrink: 0;
}

#command-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none !important;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
}

.command-palette-esc {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
}

.command-palette-body {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.command-palette-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
  border: 1px solid transparent;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.command-palette-item.active {
  background: var(--accent-soft, rgba(255, 106, 0, 0.14));
  border-color: var(--accent-border, rgba(255, 106, 0, 0.3));
}

.item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.item-details {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.command-palette-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
}

.command-palette-footer {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
}

.command-palette-footer kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  padding: 1px 4px;
  color: #fff;
}

/* ============================================================================
 * ENTERPRISE INDUSTRIAL DESIGN SYSTEM — High-Density Monitor G5 / MRPeasy UX
 * ============================================================================ */

/* ── High-Density Data Tables ───────────────────────────────────────────── */
table, .data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--soft, #f1f5f9) !important;
  color: var(--muted, #64748b) !important;
  font-family: inherit !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--border, #e2e8f0) !important;
  border-top: 1px solid var(--border, #e2e8f0) !important;
  white-space: nowrap;
}

td {
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--border, #e2e8f0) !important;
  vertical-align: middle !important;
  color: var(--ink, #0f172a);
  font-variant-numeric: tabular-nums;
}

tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.015);
}

tr:hover td {
  background: var(--soft, #f1f5f9) !important;
}

/* ── High-Contrast Form Inputs ───────────────────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="search"],
input[type="password"],
select,
textarea {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--ink) !important;
  font-family: inherit !important;
  font-size: 0.88rem !important;
  padding: 8px 12px !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

/* ── Universal Enterprise Dialog & Menu Scroll System ────────────────────── */
dialog,
.dialog {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--ink) !important;
  padding: 0 !important;
  width: min(880px, calc(100vw - 24px)) !important;
  max-height: 90dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}

.dialog-form,
.dialog-body {
  background: var(--panel) !important;
  color: var(--ink) !important;
  max-height: 90dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

.price-history-list,
.lots-list,
.attachments-list,
.operator-list,
#user-database-list,
#material-usage-list {
  max-height: 55vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
  color: var(--ink);
}

.dialog-header h2, .dialog-header h3 {
  margin: 0;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.dialog-footer,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: auto;
}

/* ── Kiosk Touchscreen PIN Overlay Polish ────────────────────────────────── */
#shopfloor-pinpad-dialog .pinpad-modal {
  background: #0d121a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.8);
  padding: 28px;
}

.pinpad-btn {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: #fff !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  transition: all 0.1s ease !important;
}

.pinpad-btn:active {
  background: var(--accent) !important;
  color: var(--accent-on) !important;
  transform: scale(0.96) !important;
}

/* ── Category Drag & Drop Reordering ───────────────────────────────────── */
.category-card.is-draggable {
  border: 1px dashed rgba(99, 102, 241, 0.4) !important;
  transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease !important;
}

.category-card.is-being-dragged {
  opacity: 0.45 !important;
  transform: scale(0.985) !important;
  border: 2px dashed var(--accent, #6366f1) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18) !important;
  background: var(--soft) !important;
}

.category-card.drag-target-over {
  border: 2px solid var(--accent, #6366f1) !important;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.25) !important;
}

.category-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab !important;
  user-select: none;
  font-size: 1.25rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--soft);
  border: 1px solid var(--border);
  color: var(--accent);
  transition: background 0.15s ease, transform 0.15s ease;
}

.category-drag-handle:hover {
  background: var(--panel);
  transform: scale(1.08);
}

.category-drag-handle:active {
  cursor: grabbing !important;
  transform: scale(0.96);
}

/* ── Automatic Device & Touch Form-Factor Adaptation ─────────────────────── */
body.device-touch,
body.device-tablet,
body.device-mobile {
  --touch-target-min: 48px;
}

body.device-touch button,
body.device-tablet button,
body.device-mobile button,
body.device-touch .primary-action,
body.device-tablet .primary-action,
body.device-mobile .primary-action,
body.device-touch .text-button,
body.device-tablet .text-button,
body.device-mobile .text-button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.92rem;
  touch-action: manipulation;
}

body.device-tablet table td,
body.device-mobile table td,
body.device-touch table td {
  padding: 10px 12px;
}

/* ── Mobile Bottom Navigation Bar & Touch UI (2X Pro Scale) ───────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  height: 94px;
  background: var(--panel, #16181c);
  border-top: 1.5px solid var(--border, rgba(255, 255, 255, 0.14));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.38);
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 12px);
  align-items: center;
  justify-content: space-around;
  box-sizing: border-box;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  height: 100%;
  min-height: 76px;
  background: none;
  border: none;
  color: var(--ink-muted, #8b949e);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s ease, transform 0.1s ease;
  padding: 4px 0;
}

.mobile-nav-item svg {
  width: 36px;
  height: 36px;
  transition: transform 0.15s ease;
}

.mobile-nav-item.active {
  color: var(--accent, #ff6a00);
}

.mobile-nav-item.active svg {
  transform: scale(1.1);
  filter: drop-shadow(0 2px 8px rgba(255, 106, 0, 0.35));
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-fab {
  position: relative;
  top: -24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  overflow: visible !important;
  padding: 0 !important;
  z-index: 10000;
}

.mobile-nav-fab * {
  pointer-events: none;
}

.mobile-fab-circle {
  width: 76px !important;
  height: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
  min-height: 76px !important;
  max-height: 76px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 10px 28px rgba(67, 56, 202, 0.55), 0 4px 10px rgba(0, 0, 0, 0.18) !important;
  border: 4px solid var(--panel, #ffffff) !important;
  margin-bottom: 4px !important;
  flex-shrink: 0 !important;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease !important;
}

.mobile-fab-circle svg {
  width: 38px !important;
  height: 38px !important;
  fill: #ffffff !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25)) !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.mobile-nav-fab:hover .mobile-fab-circle {
  transform: translateY(-3px) scale(1.06) !important;
  box-shadow: 0 14px 34px rgba(67, 56, 202, 0.65), 0 5px 12px rgba(0, 0, 0, 0.2) !important;
}

.mobile-nav-fab:hover .mobile-fab-circle svg {
  transform: rotate(90deg) !important;
}

.mobile-nav-fab:active .mobile-fab-circle {
  transform: translateY(0) scale(0.92) !important;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.4) !important;
}

.mobile-nav-fab span {
  font-size: 14px !important;
  font-weight: 800 !important;
  color: var(--accent, #4338ca) !important;
  margin-top: 2px !important;
  white-space: nowrap !important;
  letter-spacing: -0.01em !important;
}

/* ── Mobile Auto-Scaling & Fluid Viewport Engine (Up to 840px / Phones) ────────── */
@media (max-width: 840px), (max-width: 1080px) and (pointer: coarse) and (orientation: portrait) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    font-size: 17px !important; /* Native iOS/Samsung Body Font Standard: 17px */
    line-height: 1.5 !important;
    -webkit-text-size-adjust: 100% !important;
    letter-spacing: -0.01em !important;
  }

  .sidebar {
    display: none !important;
  }
  
  .mobile-bottom-nav {
    display: flex !important;
    height: 94px !important;
    padding-bottom: env(safe-area-inset-bottom, 12px) !important;
    box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.38) !important;
  }

  .shell {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .main {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    padding: 0 14px 128px 14px !important;
    overflow-x: hidden !important;
    background: var(--bg) !important;
  }

  /* ── Senior Product Designer Mobile Topbar (iOS / One UI Large Navigation) ── */
  .topbar {
    display: flex !important;
    flex-direction: column !important;
    padding: 14px 16px !important;
    gap: 12px !important;
    border-radius: 0 0 22px 22px !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid var(--border) !important;
    background: var(--panel) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07) !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Row 1: Header title on left, compact actions on right */
  .topbar-header-row,
  .topbar-main-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .topbar-upper-right {
    display: none !important;
  }

  .topbar-title-wrap {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
  }

  .topbar h1 {
    font-size: 1.6rem !important; /* Large Title standard */
    font-weight: 800 !important;
    margin: 0 !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    letter-spacing: -0.02em !important;
    color: var(--ink) !important;
  }

  .topbar .eyebrow {
    display: none !important;
  }

  .top-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    width: auto !important;
  }

  /* Row 2: Full-width search bar */
  .command-palette-trigger {
    width: 100% !important;
    min-height: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
    padding: 0 16px !important;
    font-size: 1rem !important;
    background: var(--soft) !important;
    border: 1px solid var(--border) !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    gap: 8px !important;
  }

  .command-palette-trigger kbd {
    display: none !important;
  }

  /* Hide excessive desktop-only clutter on mobile */
  #show-shortcuts-btn,
  #logout-user,
  #quick-add-menu-btn,
  .dropdown-wrapper,
  #license-badge,
  #offline-sync-badge,
  .operator-login,
  .dashboard-toolbar,
  #shift-status-pill,
  #quick-pin-switch-btn {
    display: none !important;
  }

  #camera-qr-btn,
  #notification-bell-btn {
    min-width: 42px !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    background: var(--soft) !important;
    border: 1px solid var(--border) !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
  }

  #lang-switcher {
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 1px solid var(--border) !important;
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  #lang-switcher .theme-chip:not(.active) {
    display: none !important;
  }

  #lang-switcher .theme-chip.active {
    padding: 0 12px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    min-height: 40px !important;
    height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  #shift-attendance-container {
    margin-left: auto !important;
  }

  .topbar-clock-pill {
    padding: 6px 12px !important;
    gap: 6px !important;
    min-height: 42px !important;
    height: 42px !important;
    font-size: 0.95rem !important;
    border-radius: 12px !important;
    font-family: var(--mono, monospace) !important;
    font-weight: 700 !important;
    box-sizing: border-box !important;
  }

  .topbar-clock-pill .clock-tz-badge {
    display: none !important;
  }

  .shift-clock-btn {
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 16px !important;
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* ── Mobile Layout & Cards ────────────────────────────────────────── */
  .panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 22px 18px !important;
    margin-bottom: 16px !important;
    border-radius: 20px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
  }

  .panel-header {
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 14px !important;
  }

  .panel-header h2 {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
  }

  .panel-actions {
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .metrics {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px !important;
    width: 100% !important;
    margin-bottom: 16px !important;
  }

  #dashboard-view .metric {
    padding: 20px 18px !important;
    border-radius: 18px !important;
    border: 1px solid var(--border) !important;
    background: var(--panel) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  #dashboard-view .metric strong {
    font-size: 2.5rem !important; /* 42.5px Giant readable KPI numbers */
    font-weight: 800 !important;
    line-height: 1.05 !important;
    letter-spacing: -0.03em !important;
    color: var(--ink) !important;
  }

  #dashboard-view .metric span {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    color: var(--muted) !important;
    margin-top: 8px !important;
  }

  .dashboard-grid,
  .form-grid-2,
  .settings-grid,
  .inventory-layout {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 16px !important;
  }

  .live-floor-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .floor-operator-card {
    padding: 20px 18px !important;
    border-radius: 18px !important;
    margin-bottom: 12px !important;
    border: 1px solid var(--border) !important;
    background: var(--panel) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  }

  .floor-operator-card:active {
    transform: scale(0.98) !important;
  }

  .floor-op-name {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--ink) !important;
  }

  .floor-op-role {
    font-size: 0.95rem !important;
    color: var(--muted) !important;
    margin-top: 2px !important;
  }

  .floor-status-badge {
    padding: 8px 16px !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .floor-status-badge .pulse-dot {
    width: 9px !important;
    height: 9px !important;
  }

  .floor-job-title {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    margin-top: 10px !important;
    color: var(--ink) !important;
  }

  .floor-operator-card .meta {
    font-size: 0.98rem !important;
    margin-top: 8px !important;
    line-height: 1.5 !important;
    color: var(--muted) !important;
  }

  .edit-floor-operator-btn {
    min-width: 40px !important;
    min-height: 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 1.05rem !important;
    border-radius: 12px !important;
    background: var(--soft) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .data-table-container,
  .table-wrap,
  .panel-body,
  .calendar-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 14px !important;
  }

  .data-table td,
  .data-table th {
    padding: 14px 16px !important;
    font-size: 1rem !important;
  }

  /* Clean Touch Targets on Mobile (One UI / iOS Action Button specs) */
  button.primary-action,
  .primary-action {
    min-height: 52px !important;
    padding: 12px 20px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25) !important;
  }

  button.text-button,
  .text-button {
    min-height: 46px !important;
    padding: 10px 16px !important;
    font-size: 0.98rem !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
  }

  input, select, textarea {
    min-height: 50px !important;
    font-size: 17px !important; /* Standard iOS/Samsung input font */
    padding: 10px 16px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
  }

  /* Responsive Bottom Sheets for Dialogs on Mobile */
  dialog.dialog {
    margin: auto auto 0 auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 24px !important;
    border-top-right-radius: 24px !important;
    max-height: 92vh !important;
    padding: 24px 20px !important;
    box-sizing: border-box !important;
    animation: slideUpBottom 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3) !important;
  }

  @keyframes slideUpBottom {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

/* ── Tablet Multi-Column & Collapsible Icon Rail (841px - 1080px) ───────── */
@media (min-width: 841px) and (max-width: 1080px) and (orientation: landscape), (min-width: 841px) and (max-width: 1080px) and (pointer: fine) {
  .shell {
    grid-template-columns: 72px 1fr !important;
  }

  .sidebar {
    width: 72px !important;
    padding: 14px 6px !important;
  }

  .sidebar .nav-item span,
  .sidebar .sidebar-logo span,
  .sidebar .eyebrow {
    display: none !important;
  }

  .sidebar .nav-item {
    justify-content: center !important;
    padding: 10px !important;
    min-height: 48px !important;
  }

  .sidebar .nav-item svg {
    margin: 0 !important;
  }

  .dashboard-grid,
  .form-grid-2 {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ── Explicit Mobile Phone Device Mode Overrides ────────────────────────── */
body.device-mobile .sidebar,
html[data-device="mobile"] .sidebar {
  display: none !important;
}

body.device-mobile .mobile-bottom-nav,
html[data-device="mobile"] .mobile-bottom-nav {
  display: flex !important;
  height: 94px !important;
  padding-bottom: env(safe-area-inset-bottom, 12px) !important;
  box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.38) !important;
}

body.device-mobile .shell,
html[data-device="mobile"] .shell {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
}

body.device-mobile .main,
html[data-device="mobile"] .main {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  padding: 0 14px 128px 14px !important;
  overflow-x: hidden !important;
  background: var(--bg) !important;
}

body.device-mobile .topbar,
html[data-device="mobile"] .topbar {
  display: flex !important;
  flex-direction: column !important;
  padding: 14px 16px !important;
  gap: 12px !important;
  border-radius: 0 0 22px 22px !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--panel) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07) !important;
  margin-bottom: 16px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}


/* ── Human-Touch Responsive Topbar Flow & Auto-Fit ────────────────────────── */
.topbar {
  position: relative !important;
  z-index: 50 !important;
  overflow: visible !important;
  padding: 6px 14px !important;
}

.topbar-main-row {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  align-items: center !important;
  width: 100% !important;
  gap: 20px !important;
  min-width: 0 !important;
}

.topbar-title-wrap {
  grid-column: 1 !important;
  flex: 0 0 auto !important;
  min-width: max-content !important;
  position: relative !important;
  z-index: 10 !important;
}

.topbar-actions {
  grid-column: 2 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 5px !important;
  flex-wrap: nowrap !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
}
.topbar-actions::-webkit-scrollbar {
  display: none !important;
}

.topbar-actions #show-shortcuts-btn,
.topbar-actions #camera-qr-btn,
.topbar-actions #notification-bell-btn {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  font-size: 13px !important;
  border-radius: 6px !important;
  flex-shrink: 0 !important;
}

.topbar-clock-pill {
  padding: 0 8px !important;
  border-radius: 999px !important;
  font-size: 0.76rem !important;
  gap: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
}

.topbar-actions .command-palette-trigger {
  max-width: 95px !important;
  flex-shrink: 0 !important;
}

.topbar-actions .operator-login {
  max-width: 100px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex-shrink: 1 !important;
}

/* Screens <= 1750px: Hide secondary utility buttons & license badge */
@media (max-width: 1750px) {
  .topbar-actions #camera-qr-btn,
  .topbar-actions #show-shortcuts-btn {
    display: none !important;
  }
  .topbar-actions .license-badge {
    display: none !important;
  }
  .topbar-clock-pill .clock-tz-badge {
    display: none !important;
  }
}

/* Screens <= 1550px: Compact search trigger, clock & shift pill */
@media (max-width: 1550px) {
  .topbar-actions {
    gap: 4px !important;
  }
  .topbar-actions .command-palette-trigger {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
  }
  .topbar-actions .command-palette-trigger span,
  .topbar-actions .command-palette-trigger kbd {
    display: none !important;
  }
  .topbar-actions #shift-status-pill #shift-status-text {
    display: none !important;
  }
  .topbar-actions #shift-status-pill {
    padding: 4px 6px !important;
    min-width: unset !important;
  }
  .topbar-actions .operator-login {
    max-width: 80px !important;
  }
  .topbar-actions .topbar-clock-pill {
    padding: 0 6px !important;
    font-size: 0.74rem !important;
  }
}

/* Screens <= 1400px: Compact quick add button & hide clock */
@media (max-width: 1400px) {
  .topbar-actions #quick-add-menu-btn span {
    display: none !important;
  }
  .topbar-actions #quick-add-menu-btn {
    padding: 0 8px !important;
  }
  .topbar-actions .topbar-clock-pill {
    display: none !important;
  }
  .topbar-actions .operator-login {
    max-width: 70px !important;
  }
}

/* Screens <= 1180px: Compact PIN & hide operator name */
@media (max-width: 1180px) {
  .topbar-actions .command-palette-trigger {
    display: none !important;
  }
  .topbar-actions #quick-pin-switch-btn {
    padding: 0 5px !important;
    font-size: 0.68rem !important;
  }
  .topbar-actions .operator-login {
    display: none !important;
  }
}

body.device-mobile .topbar-header-row,
html[data-device="mobile"] .topbar-header-row,
body.device-mobile .topbar-main-row,
html[data-device="mobile"] .topbar-main-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 10px !important;
}

body.device-mobile .topbar-upper-right,
html[data-device="mobile"] .topbar-upper-right {
  display: none !important;
}

body.device-mobile .topbar h1,
html[data-device="mobile"] .topbar h1 {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  margin: 0 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  letter-spacing: -0.02em !important;
  color: var(--ink) !important;
}

body.device-mobile .command-palette-trigger,
html[data-device="mobile"] .command-palette-trigger {
  width: 100% !important;
  min-height: 48px !important;
  height: 48px !important;
  border-radius: 14px !important;
  padding: 0 16px !important;
  font-size: 1rem !important;
  background: var(--soft) !important;
  border: 1px solid var(--border) !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
  gap: 8px !important;
}

body.device-mobile #show-shortcuts-btn,
body.device-mobile #logout-user,
body.device-mobile #quick-add-menu-btn,
body.device-mobile .dropdown-wrapper,
body.device-mobile #license-badge,
body.device-mobile #offline-sync-badge,
body.device-mobile .operator-login,
body.device-mobile .dashboard-toolbar,
body.device-mobile #shift-status-pill,
body.device-mobile #quick-pin-switch-btn,
html[data-device="mobile"] #show-shortcuts-btn,
html[data-device="mobile"] #logout-user,
html[data-device="mobile"] #quick-add-menu-btn,
html[data-device="mobile"] .dropdown-wrapper,
html[data-device="mobile"] #license-badge,
html[data-device="mobile"] #offline-sync-badge,
html[data-device="mobile"] .operator-login,
html[data-device="mobile"] .dashboard-toolbar,
html[data-device="mobile"] #shift-status-pill,
html[data-device="mobile"] #quick-pin-switch-btn {
  display: none !important;
}

body.device-mobile .panel,
html[data-device="mobile"] .panel {
  padding: 22px 18px !important;
  border-radius: 20px !important;
  margin-bottom: 16px !important;
}

body.device-mobile .dashboard-grid,
body.device-mobile .inventory-layout,
body.device-mobile .costing-layout,
body.device-mobile .settings-grid,
body.device-mobile .settings-monitor-row,
body.device-mobile .quality-comparison,
body.device-mobile .form-grid-2,
html[data-device="mobile"] .dashboard-grid,
html[data-device="mobile"] .inventory-layout,
html[data-device="mobile"] .costing-layout,
html[data-device="mobile"] .settings-grid,
html[data-device="mobile"] .settings-monitor-row,
html[data-device="mobile"] .quality-comparison,
html[data-device="mobile"] .form-grid-2 {
  grid-template-columns: 1fr !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 16px !important;
}

/* ── All-Day Eye Ergonomics & Smooth Contrast ───────────────────────────── */
.data-table tbody tr {
  transition: background 0.15s ease, border-color 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 106, 0, 0.04) !important;
}

:root[data-theme="slate"] .data-table tbody tr:hover {
  background: rgba(120, 145, 181, 0.06) !important;
}

.tag {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
}

/* ── Dedicated Customer Order Tracking Portal & Complete App Isolation ── */
html.client-portal-active,
body.client-portal-active {
  background: var(--bg, #f8fafc) !important;
  color: var(--ink, #0f172a) !important;
  overflow-x: hidden !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.client-portal-active .shell,
body.client-portal-active #mobile-bottom-nav,
body.client-portal-active #onboarding-float,
body.client-portal-active dialog:not(#customer-portal-dialog),
body.client-portal-active .api-status-banner,
body.client-portal-active #ptr-indicator {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}

#share-portal-overlay,
#customer-tracking-portal {
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 16px 64px;
  background: var(--bg, #f8fafc);
  color: var(--ink, #0f172a);
  font-family: inherit;
  box-sizing: border-box;
}

.portal-container {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.portal-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.portal-brand-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink, #0f172a);
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

.portal-card {
  background: var(--panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

.portal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.portal-wo-id {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.portal-part-name {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent, #4f46e5);
  margin-top: 4px;
}

.portal-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.portal-progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--soft, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
}

.portal-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
}

.portal-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.portal-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5, #6366f1);
  transition: width 0.4s ease;
}

.portal-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #e2e8f0);
}

.portal-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal-detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #64748b);
  font-weight: 600;
}

.portal-detail-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
}

.portal-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  margin: 6px 0;
  gap: 4px;
}

.portal-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.portal-step-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.portal-step-bubble.completed {
  background: #22c55e;
  color: #ffffff;
}

.portal-step-bubble.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

.portal-step-bubble.pending {
  background: var(--soft, #f1f5f9);
  color: var(--muted, #94a3b8);
  border: 1px solid var(--border, #e2e8f0);
}

.portal-step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  line-height: 1.2;
}

.portal-step-label.active {
  color: var(--accent, #4f46e5);
  font-weight: 700;
}

.portal-step-label.completed {
  color: #16a34a;
}

.portal-notice-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--accent, #4f46e5);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.portal-print-btn {
  background: var(--panel, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  color: var(--ink, #1e293b);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease;
  width: 100%;
}

.portal-print-btn:hover {
  background: #f1f5f9;
}

@media print {
  body.client-portal-active {
    background: #ffffff !important;
    color: #000000 !important;
  }
  #share-portal-overlay {
    padding: 0 !important;
  }
  .portal-card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
  }
  .portal-print-btn,
  .portal-footer {
    display: none !important;
  }
}

/* Mobile Quick Add Bottom Action Sheet */
dialog.mobile-action-sheet {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 auto !important;
  width: 100% !important;
  max-width: 480px !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  outline: none !important;
  z-index: 10001 !important;
}

dialog.mobile-action-sheet:not([open]) {
  display: none !important;
}

dialog.mobile-action-sheet::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

dialog.mobile-action-sheet[open] {
  display: block !important;
  animation: slideUpActionSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpActionSheet {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-quick-btn {
  transition: background 0.15s ease, transform 0.1s ease;
}

.mobile-quick-btn:hover {
  background: var(--soft-2, #e2e8f0) !important;
}

.mobile-quick-btn:active {
  transform: scale(0.97);
}

/* ── Adaptive Dashboard Grid & Interactive Mouse Drag-and-Drop ─────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
  align-items: start;
}

@media (min-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

.dashboard-grid > .panel.widget-span-full {
  grid-column: 1 / -1 !important;
}

.dashboard-grid > .panel.widget-span-half {
  grid-column: span 1 !important;
}

.dashboard-grid > .panel.is-customizing {
  position: relative;
  border: 1.5px dashed var(--accent, #4338ca) !important;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.08);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-grid > .panel.is-customizing:hover {
  border-color: var(--accent, #4338ca) !important;
  box-shadow: 0 8px 24px rgba(67, 56, 202, 0.14);
}

.widget-edit-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.widget-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--soft-2, rgba(255, 255, 255, 0.08));
  color: var(--ink-muted, #8b949e);
  font-size: 1.15rem;
  line-height: 1;
  user-select: none;
  touch-action: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.widget-drag-handle:hover {
  background: var(--accent-soft, rgba(67, 56, 202, 0.15));
  color: var(--accent, #4338ca);
  transform: scale(1.06);
}

.widget-drag-handle:active,
.panel.is-dragging .widget-drag-handle {
  cursor: grabbing;
}

.dashboard-grid > .panel.is-dragging {
  opacity: 0.35 !important;
  transform: scale(0.98) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25) !important;
  border: 2px dashed var(--accent, #4338ca) !important;
}

.dashboard-drop-placeholder {
  grid-column: span 1;
  min-height: 140px;
  border: 2px dashed var(--accent, #4338ca);
  background: rgba(67, 56, 202, 0.07);
  border-radius: var(--radius-lg, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #4338ca);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  pointer-events: none;
  animation: dropPlaceholderPulse 1.2s ease-in-out infinite;
}

.dashboard-drop-placeholder.placeholder-span-full {
  grid-column: 1 / -1 !important;
}

@keyframes dropPlaceholderPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.995); }
  50% { opacity: 0.95; transform: scale(1); }
}

/* ── Timesheet & Attendance Badges ───────────────────────────────────────── */
.badge-present {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green, #22c55e);
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-active-shift {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue, #3b82f6);
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: pulseBadge 1.8s infinite ease-in-out;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.badge-auto-clockout {
  background: rgba(255, 106, 0, 0.16);
  color: var(--accent, #ff6a00);
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 106, 0, 0.3);
}

.badge-absent {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger, #ef4444);
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-sick-leave {
  background: rgba(168, 85, 247, 0.16);
  color: var(--purple, #a855f7);
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.row-auto-clockout {
  background: rgba(255, 106, 0, 0.04);
}

.row-absent-day {
  background: rgba(239, 68, 68, 0.05);
}

/* ── Live Shop Floor Operator Card Interactive Styles ────────────────────── */
.floor-operator-card.can-edit-operator {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.floor-operator-card.can-edit-operator:hover {
  border-color: var(--accent, #ff6a00);
  box-shadow: 0 4px 14px rgba(255, 106, 0, 0.12);
  transform: translateY(-2px);
}

.floor-operator-card.can-edit-operator .edit-floor-operator-btn {
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.floor-operator-card.can-edit-operator:hover .edit-floor-operator-btn {
  opacity: 1;
  transform: scale(1.05);
}

.highlight-user-row {
  outline: 2px solid var(--accent, #ff6a00) !important;
  box-shadow: 0 0 16px rgba(255, 106, 0, 0.3) !important;
  border-radius: 8px;
  animation: pulseUserHighlight 1.5s ease-in-out;
}

@keyframes pulseUserHighlight {
  0% { transform: scale(1); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

/* ── Mobile & Tablet PIN Keypad Adaptive Rules ─────────────────────────── */
#shopfloor-pinpad-dialog {
  width: min(440px, calc(100vw - 24px)) !important;
  max-width: 440px !important;
  padding: clamp(16px, 3.5vw, 28px);
  border-radius: 16px;
  background: var(--panel, #121418);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

#shopfloor-pinpad-dialog::backdrop,
#login-dialog::backdrop {
  cursor: default !important;
}

@media (max-width: 600px) {
  #shopfloor-pinpad-dialog {
    width: min(94vw, 420px) !important;
    max-height: 92vh !important;
    padding: 16px 14px !important;
    margin: auto;
  }
  #shopfloor-pinpad-dialog .pinpad-display span {
    min-height: 48px;
    font-size: 1.25rem;
    border-radius: 8px;
  }
  #shopfloor-pinpad-dialog .pinpad-key {
    min-height: 52px;
    font-size: 1.3rem;
    border-radius: 10px;
  }
}

@media (min-width: 601px) and (max-width: 1024px) {
  #shopfloor-pinpad-dialog {
    width: min(85vw, 500px) !important;
    max-height: 90vh !important;
    padding: 26px !important;
    margin: auto;
  }
  #shopfloor-pinpad-dialog .pinpad-display span {
    min-height: 60px;
    font-size: 1.7rem;
    border-radius: 12px;
  }
  #shopfloor-pinpad-dialog .pinpad-key {
    min-height: 64px;
    font-size: 1.55rem;
    border-radius: 14px;
  }
}







