/* ============================================================
   OS SHELL — Windows 11 / macOS-inspired presentation layer.
   Additive overlay: hides the legacy sidebar/bottom-nav and adds a
   floating bottom taskbar + Start menu + window-chrome dots + a
   file-explorer toolbar for Projects. Loaded after every other
   stylesheet so its rules win without needing to edit them.
   ============================================================ */

:root {
  --os-taskbar-h: 60px;
  --os-taskbar-bg: rgba(255, 255, 255, .88);
  --os-taskbar-border: rgba(20, 40, 60, .08);
  --os-accent: var(--coral, #ff6b57);
  --os-ink: var(--navy, #16324f);
  --os-ink-soft: var(--ink-soft, #6b7c8c);
  --os-hover: rgba(22, 50, 79, .07);
}

/* ── Neutralize the legacy sidebar-reserved layout, fall back to the
   existing "mobile" content layout (header visible, no side gutter) on
   every viewport once the OS shell takes over. ── */
body.os-shell-active .app-sidebar,
body.os-shell-active #btn-sidebar-open,
body.os-shell-active #bottom-nav,
body.os-shell-active #mobile-bottom-nav,
body.os-shell-active .mobile-nav-sheet {
  display: none !important;
}
body.os-shell-active {
  --shell-sidebar-width: 0px;
  --nav-h: var(--os-taskbar-h);
}
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) {
  padding: 0 !important;
}
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .app-header {
  display: flex !important;
}
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .pg-tabs,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .detail-tab-bar,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .pg-filter-bar,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .pg-filter-row,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .wh-filter-bar,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .q-filter-bar,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .members-section,
body.os-shell-active .screen:not(#screen-login):not(#screen-splash) .pg-stats-strip {
  margin-top: 16px !important;
}
body.os-shell-active .detail-actions {
  left: 12px !important;
  right: 12px !important;
  bottom: calc(var(--os-taskbar-h) + 16px) !important;
  width: auto !important;
  transform: none !important;
}

/* ── Window chrome: traffic-light-style dots on every screen header ── */
.os-window-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline-end: 12px;
  margin-inline-end: 10px;
  border-inline-end: 1px solid var(--clr-border, #e4ebf1);
  flex-shrink: 0;
}
.os-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.os-dot:hover { transform: scale(1.15); filter: brightness(1.08); }
.os-dot--close { background: #ff5f57; }
.os-dot--min   { background: #febc2e; }
.os-dot--max   { background: #28c840; }

/* ── Taskbar ── */
.os-taskbar {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 4000;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--os-taskbar-h);
  padding: 0 8px;
  max-width: calc(100vw - 16px);
  background: var(--os-taskbar-bg);
  border: 1px solid var(--os-taskbar-border);
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(20, 40, 60, .16), 0 2px 6px rgba(20, 40, 60, .06), inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

.os-taskbar__start {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: background .12s ease;
  flex-shrink: 0;
}
.os-taskbar__start:hover,
.os-taskbar__start[aria-expanded="true"] { background: rgba(22, 50, 79, .08); }
.os-start-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--os-ink), var(--os-accent));
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: -.02em;
}

.os-taskbar__apps {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  border-inline: 1px solid rgba(20, 40, 60, .08);
  margin-inline: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.os-taskbar__apps::-webkit-scrollbar { display: none; }

.os-taskbar__app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 62px;
  height: 46px;
  padding: 4px 3px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--os-ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s ease;
  position: relative;
}
.os-taskbar__app svg { width: 19px; height: 19px; }
.os-taskbar__app:hover { background: rgba(22, 50, 79, .08); }
.os-taskbar__app.active { background: rgba(255, 107, 87, .14); color: var(--os-accent); }
.os-taskbar__app.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: var(--os-accent);
}
.os-taskbar__label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 7.8px;
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  word-break: break-word;
}

.os-taskbar__tray {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.os-tray-btn,
.os-tray-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--os-ink);
  cursor: pointer;
}
.os-tray-btn:hover, .os-tray-avatar:hover { background: rgba(22, 50, 79, .08); }
.os-tray-btn svg { width: 18px; height: 18px; }
.os-tray-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--os-accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}
.os-tray-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--os-ink);
  cursor: default;
}
.os-tray-clock span { font-size: 12px; font-weight: 800; line-height: 1.2; }
.os-tray-clock small { font-size: 9px; font-weight: 600; color: var(--ink-soft, #6b7c8c); }
.os-tray-avatar {
  overflow: hidden;
  background: linear-gradient(135deg, var(--os-ink), #2a587d);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}
.os-tray-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

/* ── Start menu ── */
.os-start-menu {
  position: fixed;
  left: 50%;
  bottom: calc(var(--os-taskbar-h) + 20px);
  transform: translateX(-50%);
  z-index: 4001;
  width: min(92vw, 460px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--os-taskbar-bg);
  border: 1px solid var(--os-taskbar-border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(20, 40, 60, .28);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  padding: 16px;
}
.os-start-menu.hidden { display: none; }
.os-start-menu__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(20, 40, 60, .1);
}
.os-start-menu__header strong { font-size: 15px; font-weight: 900; color: var(--os-ink); }
.os-start-menu__header span { font-size: 11px; font-weight: 700; color: var(--ink-soft, #6b7c8c); text-transform: uppercase; letter-spacing: .04em; }
.os-start-menu__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.os-start-menu__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 6px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .5);
  color: var(--os-ink);
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  transition: background .12s ease, transform .12s ease;
}
.os-start-menu__item:hover { background: rgba(255, 107, 87, .12); transform: translateY(-1px); }
.os-start-menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface, #fff);
  box-shadow: 0 4px 10px rgba(20, 40, 60, .1);
}
.os-start-menu__icon svg { width: 19px; height: 19px; }
.os-start-menu__footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(20, 40, 60, .1);
}
.os-start-menu__logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 95, 87, .1);
  color: #c2372b;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
}
.os-start-menu__logout svg { width: 16px; height: 16px; }
.os-start-menu__logout:hover { background: rgba(255, 95, 87, .18); }

/* ── Projects: file-explorer toolbar ── */
.os-explorer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 4px;
  padding: 10px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--clr-border, #e4ebf1);
  border-radius: 12px;
}
.os-explorer-bar__path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--os-ink);
}
.os-explorer-crumb {
  display: flex;
  align-items: center;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft, #6b7c8c);
  cursor: pointer;
}
.os-explorer-crumb:hover { background: rgba(22, 50, 79, .08); }
.os-explorer-crumb svg { width: 15px; height: 15px; }
.os-explorer-crumb--current { color: var(--os-ink); cursor: default; padding: 0; }
.os-explorer-sep { color: var(--ink-soft, #6b7c8c); font-size: 13px; }
.os-explorer-bar__views {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-soft, #f5f8fb);
  border-radius: 9px;
  flex-shrink: 0;
}
.os-explorer-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft, #6b7c8c);
  cursor: pointer;
}
.os-explorer-view-btn svg { width: 15px; height: 15px; }
.os-explorer-view-btn.active { background: var(--surface, #fff); color: var(--os-accent); box-shadow: 0 1px 4px rgba(20, 40, 60, .12); }

/* Folder-grid mode for the projects list */
#projects-list.os-explorer-folders {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
  gap: 16px !important;
}

@media (max-width: 640px) {
  #projects-list.os-explorer-folders {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* ── Mobile: taskbar shrinks, no labels, room preserved for content ── */
@media (max-width: 640px) {
  :root { --os-taskbar-h: 54px; }
  .os-taskbar {
    bottom: 6px;
    padding: 0 4px;
    gap: 2px;
    border-radius: 16px;
    max-width: calc(100vw - 12px);
    overflow: hidden;
  }
  .os-taskbar__start { width: 36px; height: 36px; border-radius: 10px; }
  .os-start-logo { width: 24px; height: 24px; font-size: 11px; }
  .os-taskbar__apps {
    gap: 2px;
    padding: 0 2px;
    margin-inline: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }
  .os-taskbar__apps::-webkit-scrollbar { display: none; }
  .os-taskbar__app { width: 38px; height: 38px; padding: 2px; border-radius: 9px; }
  .os-taskbar__app svg { width: 17px; height: 17px; }
  .os-taskbar__label { display: none; }
  .os-taskbar__tray { gap: 1px; }
  .os-tray-btn, .os-tray-avatar { width: 32px; height: 32px; border-radius: 9px; }
  .os-tray-btn svg { width: 16px; height: 16px; }
  .os-tray-clock { padding: 2px 4px; }
  .os-tray-clock span { font-size: 10.5px; }
  .os-tray-clock small { display: none; }
  .os-start-menu { width: calc(100vw - 16px); bottom: calc(var(--os-taskbar-h) + 14px); }
  .os-start-menu__grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 400px) {
  .os-tray-clock { display: none; }
}

/* This app has no dark theme (see css/style.css: dark-theme variants were
   deliberately removed as dead code) — the OS shell stays on the same
   light glass treatment as the rest of the UI, in every OS/browser color
   scheme, rather than reacting to prefers-color-scheme on its own and
   looking mismatched next to an app that never changes. */

/* ============================================================
   OS SHELL — Boot (splash) + Sign-in (login) screens
   Windows 11/macOS-style boot sequence and lock/login screen,
   layered on top of the existing splash.php/login.php markup —
   no structural changes needed, every id/class already exists.
   ============================================================ */

/* ── Boot screen ── */
/* Neutral grey radial vignette, matching the classic Windows boot/loading
   screen (light center fading to grey at the edges) rather than the app's
   brand colors — a boot screen is its own one-off moment, not the app UI. */
#screen-splash {
  background: radial-gradient(circle at 50% 42%, #eceef0 0%, #d7dadd 55%, #9a9ea2 100%);
}
#screen-splash .splash-orb { display: none; }
#screen-splash .splash-ring-wrap { position: relative; }
#screen-splash .splash-ring {
  border-color: rgba(22, 50, 79, .12);
  animation: osBootRingSpin 3.4s linear infinite;
}
#screen-splash .splash-ring-2 { animation-duration: 5.2s; animation-direction: reverse; }
@keyframes osBootRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
#screen-splash .splash-logo-wrap {
  box-shadow: 0 20px 46px rgba(20, 40, 60, .16);
}
#screen-splash .splash-progress-track {
  overflow: hidden;
  background: rgba(22, 50, 79, .1);
}
#screen-splash .splash-progress-bar {
  background: linear-gradient(90deg, var(--os-ink, #16324f), var(--os-accent, #ff6b57));
  animation: osBootIndeterminate 1.6s ease-in-out infinite;
}
@keyframes osBootIndeterminate {
  0%   { transform: translateX(-100%) scaleX(.4); }
  50%  { transform: translateX(10%) scaleX(.7); }
  100% { transform: translateX(100%) scaleX(.4); }
}
/* Windows-style sequential boot dots, replacing the plain three-dot pulse */
#screen-splash .splash-dots { display: inline-flex; gap: 5px; }
#screen-splash .splash-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--os-accent, #ff6b57);
  opacity: .25;
  animation: osBootDot 1.2s ease-in-out infinite;
}
#screen-splash .splash-dot:nth-child(1) { animation-delay: 0s; }
#screen-splash .splash-dot:nth-child(2) { animation-delay: .15s; }
#screen-splash .splash-dot:nth-child(3) { animation-delay: .3s; }
@keyframes osBootDot {
  0%, 60%, 100% { opacity: .25; transform: scale(.85); }
  30% { opacity: 1; transform: scale(1); }
}

/* ── Sign-in screen ── */
#screen-login {
  background:
    radial-gradient(1100px 650px at 12% 8%, rgba(255, 107, 87, .18), transparent 55%),
    radial-gradient(1000px 700px at 90% 95%, rgba(22, 50, 79, .22), transparent 55%),
    radial-gradient(700px 500px at 60% 40%, rgba(70, 130, 180, .10), transparent 60%),
    linear-gradient(150deg, #f0f4f9 0%, #e6edf5 60%, #dce4ee 100%);
}
#screen-login .login-orb { filter: blur(70px); opacity: .6; }
#screen-login .login-container {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 28px;
  box-shadow: 0 32px 72px rgba(22, 50, 79, .16), inset 0 1px 0 rgba(255, 255, 255, .95);
}
#screen-login .login-logo-wrap {
  filter: drop-shadow(0 12px 24px rgba(22, 50, 79, .15));
}
#screen-login .login-logo-ring {
  border-color: rgba(22, 50, 79, .16);
}
#screen-login .login-input-wrap {
  background: rgba(255, 255, 255, .92);
  border-radius: 16px;
  border: 1.5px solid rgba(22, 50, 79, .12);
}
#screen-login .login-input-wrap:focus-within {
  border-color: var(--coral, #ff6b57);
  box-shadow: 0 0 0 4px rgba(255, 107, 87, .16);
}
#screen-login .login-btn {
  border-radius: 16px;
  background: linear-gradient(135deg, var(--os-ink, #16324f) 0%, var(--os-accent, #ff6b57) 100%);
  box-shadow: 0 14px 28px rgba(22, 50, 79, .22);
}
#screen-login .login-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #0f243a 0%, #ff5740 100%);
  box-shadow: 0 18px 32px rgba(255, 107, 87, .32);
}
#screen-login .login-showcase {
  background: linear-gradient(165deg, var(--os-ink, #16324f) 0%, #1a3c5e 60%, #254d73 100%);
}

/* ============================================================
   OS SHELL — Toast notifications, Windows 11 style: bottom-right
   corner card with a colored accent bar + icon, slide-in from the
   edge, sitting clear of the floating taskbar.
   ============================================================ */
.toast {
  left: auto !important;
  right: 16px !important;
  bottom: calc(var(--os-taskbar-h, 60px) + 18px) !important;
  transform: translateX(0) !important;
  max-width: min(360px, calc(100vw - 32px));
  min-width: 240px;
  padding: 13px 16px 13px 14px !important;
  display: flex !important;
  align-items: center;
  gap: 10px;
  white-space: normal !important;
  color: var(--os-ink, #16324f) !important;
  background: rgba(255, 255, 255, .96) !important;
  border: 1px solid rgba(20, 40, 60, .08) !important;
  border-inline-start: 4px solid #6b7c8c !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 36px rgba(20, 40, 60, .2), 0 2px 8px rgba(20, 40, 60, .08) !important;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: opacity .18s ease, transform .18s ease;
}
.toast:not(.show) { transform: translateX(16px) !important; }
.toast::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: var(--os-toast-icon) center / contain no-repeat;
  mask: var(--os-toast-icon) center / contain no-repeat;
}
.toast.success {
  border-inline-start-color: #1a9d5c !important;
  color: #14532d !important;
  --os-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.toast.error {
  border-inline-start-color: #d33a2c !important;
  color: #7a1f17 !important;
  --os-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
}
.toast.info {
  border-inline-start-color: #2f6fb3 !important;
  color: #1c3f5f !important;
  --os-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
}
.toast.warn {
  border-inline-start-color: #c98a1a !important;
  color: #6b4a08 !important;
  --os-toast-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}
@media (max-width: 640px) {
  .toast {
    right: 10px !important;
    left: 10px !important;
    max-width: none;
    bottom: calc(var(--os-taskbar-h, 56px) + 14px) !important;
  }
}

/* ============================================================
   OS SHELL — Work Orders calendar: full page width, consistent
   sizing between desktop and mobile (it was previously capped to
   480px and centered on desktop, and used tiny fixed font sizes
   regardless of the available width).
   ============================================================ */
#screen-all-tasks .tasks-calendar {
  width: min(100%, 1460px);
  max-width: none !important;
  margin: 8px auto 0 !important;
  padding: 14px 16px 16px;
}
@media (min-width: 769px) {
  #screen-all-tasks .tasks-calendar__weekdays span {
    font-size: 11px;
  }
  #screen-all-tasks .tasks-calendar__cell {
    min-height: 40px;
    gap: 5px;
    border-radius: 10px;
  }
  #screen-all-tasks .tasks-calendar__daynum {
    font-size: 13px;
  }
  #screen-all-tasks .tasks-calendar__count {
    min-width: 16px;
    padding: 0 4px;
    font-size: 10px;
    line-height: 16px;
  }
  #screen-all-tasks .tasks-calendar__title strong {
    font-size: 14px;
  }
  #screen-all-tasks .tasks-calendar__clear {
    font-size: 11px;
  }
}

/* ============================================================
   OS SHELL — Post-login attendance gate (Clock In / Out / Skip)
   ============================================================ */
.os-attendance-gate {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 26, 38, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: osGateFadeIn .18s ease;
}
@keyframes osGateFadeIn { from { opacity: 0; } to { opacity: 1; } }
.os-attendance-gate__card {
  width: min(92vw, 360px);
  padding: 28px 24px 24px;
  text-align: center;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(20, 40, 60, .3);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.os-attendance-gate__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--os-ink, #16324f), var(--os-accent, #ff6b57));
  color: #fff;
  animation: osGatePulse 2s ease-in-out infinite;
}
.os-attendance-gate__icon svg { width: 30px; height: 30px; }
@keyframes osGatePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 87, .3); }
  50% { box-shadow: 0 0 0 10px rgba(255, 107, 87, 0); }
}
.os-attendance-gate__card strong {
  display: block;
  font-size: 16px;
  font-weight: 900;
  color: var(--os-ink, #16324f);
  margin-bottom: 6px;
}
.os-attendance-gate__card p {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft, #6b7c8c);
}
.os-attendance-gate__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.os-attendance-gate__actions .btn { width: 100%; justify-content: center; }

/* ============================================================
   OS SHELL — Checklist run: expand cards naturally downward on mobile.
   Eliminate card overlap by making .dc-routine-shell a clean flex column,
   allowing .dc-routine-titlebar to contain all metadata fields within its
   dark blue background, and restoring full vertical scrolling with a scrollbar.
   ============================================================ */
#screen-daily-checklist-run .detail-container.dc-routine-shell,
#screen-daily-checklist-run .dc-routine-shell {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  height: 100% !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 12px 12px calc(var(--os-taskbar-h, 54px) + 36px) !important;
  scrollbar-width: thin !important;
  scrollbar-color: #6b7c8c transparent !important;
}

#screen-daily-checklist-run .detail-container::-webkit-scrollbar {
  width: 6px !important;
}

#screen-daily-checklist-run .detail-container::-webkit-scrollbar-thumb {
  background: #6b7c8c !important;
  border-radius: 999px !important;
}

#screen-daily-checklist-run .detail-container::-webkit-scrollbar-track {
  background: transparent !important;
}

#screen-daily-checklist-run .dc-routine-shell > * {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: min-content !important;
  margin-bottom: 0 !important;
}

#screen-daily-checklist-run .dc-routine-titlebar {
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  min-height: min-content !important;
  overflow: hidden !important;
  border-radius: var(--radius-card, 16px) !important;
  background: linear-gradient(135deg, #183752 0%, #2a587d 100%) !important;
}

@media (min-width: 721px) {
  #screen-daily-checklist-run .dc-routine-titlebar {
    display: grid !important;
    grid-template-columns: minmax(220px, .9fr) minmax(0, 1.5fr) !important;
  }
}

#screen-daily-checklist-run .dc-progress-wrap {
  position: relative !important;
  z-index: 1 !important;
  height: auto !important;
  margin-top: 0 !important;
  overflow: hidden !important;
  border-radius: var(--radius-card, 16px) !important;
}

#screen-daily-checklist-run #dcr-items {
  max-height: none !important;
  overflow: visible !important;
}

#screen-daily-checklist-run .dc-inspection-sheet {
  height: auto !important;
  overflow: hidden !important;
  border-radius: var(--radius-card, 16px) !important;
}

/* ============================================================
   OS SHELL — Vista-style "gadget" sidebar: a docked panel with a
   digital clock widget on top and, below it, the active screen's
   filter bar + header action buttons (relocated there by JS).
   ============================================================ */
.os-gadget-sidebar {
  position: fixed;
  top: 16px;
  right: 14px;
  bottom: calc(var(--os-taskbar-h, 60px) + 20px);
  z-index: 3900;
  width: 240px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.os-gadget-sidebar.hidden { display: none; }

.os-gadget {
  flex-shrink: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(28, 40, 54, .82), rgba(14, 22, 32, .82));
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 18px 40px rgba(10, 18, 28, .35), inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 0 0 1px rgba(0, 0, 0, .15);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  color: #fff;
  overflow: hidden;
  position: relative;
}
/* Aero glass sheen across the top of every gadget, Vista-widget style */
.os-gadget::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.os-gadget--clock {
  padding: 20px 16px;
  text-align: center;
}
.os-gadget-clock-face { position: relative; z-index: 1; }
.os-gadget-clock-time {
  font-family: 'Segoe UI', 'Consolas', ui-monospace, monospace;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .03em;
  text-shadow: 0 0 14px rgba(120, 190, 255, .55), 0 1px 0 rgba(0, 0, 0, .4);
}
.os-gadget-clock-date {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, .68);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.os-gadget--tools { padding: 0; }
.os-gadget-tools-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.os-gadget-tools-head svg { width: 14px; height: 14px; }
.os-gadget-tools-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.os-gadget-tools-empty {
  margin: 4px 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .55);
  text-align: center;
}

/* Relocated elements — restyle for a narrow vertical glass panel instead
   of their original horizontal in-page toolbar layout. */
.os-gadget-tools-body .header-right,
.os-gadget-tools-body .pg-filter-bar,
.os-gadget-tools-body .collection-toolbar,
.os-gadget-tools-body .wh-filter-bar,
.os-gadget-tools-body .q-filter-bar,
.os-gadget-tools-body .eqs-filter-grid,
.os-gadget-tools-body .pg-tabs,
.os-gadget-tools-body .collection-tabs {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.os-gadget-tools-body .btn-icon {
  width: 100% !important;
  height: 38px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, .08) !important;
  color: #fff !important;
  justify-content: flex-start !important;
  padding: 0 12px !important;
  gap: 8px;
}
.os-gadget-tools-body .btn-icon svg { width: 16px; height: 16px; flex-shrink: 0; }
.os-gadget-tools-body .btn-icon:hover { background: rgba(255, 255, 255, .16) !important; }
.os-gadget-btn-label {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.os-gadget-tools-body .search-box,
.os-gadget-tools-body input[type="search"],
.os-gadget-tools-body input[type="text"],
.os-gadget-tools-body select {
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
  background: rgba(255, 255, 255, .1) !important;
  border: 1px solid rgba(255, 255, 255, .16) !important;
  color: #fff !important;
  border-radius: 10px !important;
}
.os-gadget-tools-body input::placeholder { color: rgba(255, 255, 255, .5) !important; }
.os-gadget-tools-body .pg-tab-btn {
  width: 100% !important;
  justify-content: flex-start !important;
  background: rgba(255, 255, 255, .08) !important;
  color: #fff !important;
  border: 0 !important;
}
.os-gadget-tools-body .pg-tab-btn.active {
  background: var(--os-accent, #ff6b57) !important;
}
.os-gadget-tools-body .form-group {
  width: 100%;
  margin: 0 !important;
}
.os-gadget-tools-body .form-group label {
  color: rgba(255, 255, 255, .7) !important;
  font-size: 11px !important;
}
.os-gadget-tools-body .eqs-filter-actions {
  display: flex !important;
  flex-direction: column !important;
  width: 100%;
}

/* The global-search suggestions dropdown (built for #screen-search only —
   search-layout.css scopes it with "#screen-search .search-home__…") is a
   real DOM node moved here by relocatePageToolsIntoGadget, so it loses that
   scoped styling entirely and falls back to unstyled browser-default
   boxes. Re-style it to match the gadget's own glass-panel look. */
.os-gadget-tools-body .search-home__box { width: 100%; position: relative; }
.os-gadget-tools-body .search-home__suggestions {
  position: relative !important;
  max-width: none !important;
  width: 100% !important;
  margin: 6px 0 0 !important;
  max-height: 320px;
  overflow-y: auto !important;
  background: rgba(15, 25, 38, .96) !important;
  border: 1px solid rgba(255, 255, 255, .14) !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35) !important;
}
.os-gadget-tools-body .search-home__group-label {
  color: rgba(255, 255, 255, .55) !important;
}
.os-gadget-tools-body .search-home__result {
  color: #fff !important;
  padding: 8px 12px !important;
}
.os-gadget-tools-body .search-home__result:hover {
  background: rgba(255, 255, 255, .1) !important;
}
.os-gadget-tools-body .search-home__result-subtitle {
  color: rgba(255, 255, 255, .55) !important;
}
.os-gadget-tools-body .search-home__empty,
.os-gadget-tools-body .loading-state {
  color: rgba(255, 255, 255, .6) !important;
  padding: 12px !important;
}

.os-tray-btn[aria-expanded="true"] { background: rgba(22, 50, 79, .1); }

@media (max-width: 640px) {
  .os-gadget-sidebar {
    top: auto;
    right: 8px;
    left: 8px;
    bottom: calc(var(--os-taskbar-h, 56px) + 12px);
    width: auto;
    max-height: 60vh;
  }
  .os-gadget-clock-time { font-size: 26px; }
}

/* ============================================================
   OS SHELL — Home Desktop: Windows-desktop-style landing screen
   shown right after login, with icon shortcuts for quick actions.
   ============================================================ */
#screen-home-desktop.os-desktop-screen {
  background:
    radial-gradient(1200px 700px at 15% 10%, rgba(255, 107, 87, .10), transparent 55%),
    radial-gradient(1100px 800px at 85% 95%, rgba(22, 50, 79, .14), transparent 55%),
    linear-gradient(150deg, #eef2f7 0%, #e6ebf2 55%, #e0e6ee 100%);
}
#screen-home-desktop .os-desktop-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(var(--os-taskbar-h, 60px) + 40px);
}
.os-desktop-greeting {
  margin: 4px 4px 18px;
  font-size: 20px;
  font-weight: 800;
  color: var(--os-ink, #16324f);
}
.os-desktop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 96px);
  gap: 6px 4px;
  justify-content: start;
}
.os-desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 96px;
  padding: 12px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: background .12s ease;
}
.os-desktop-icon:hover,
.os-desktop-icon:focus-visible { background: rgba(22, 50, 79, .07); }
.os-desktop-icon:active { background: rgba(255, 107, 87, .14); }
.os-desktop-icon__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--surface, #fff), var(--surface-soft, #f2f6fa));
  border: 1px solid var(--clr-border, #e4ebf1);
  box-shadow: 0 10px 22px rgba(20, 40, 60, .12);
  color: var(--os-ink, #16324f);
}
.os-desktop-icon__glyph svg { width: 24px; height: 24px; }
.os-desktop-icon__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--os-ink, #16324f);
  text-align: center;
  line-height: 1.25;
}

@media (max-width: 640px) {
  .os-desktop-grid {
    grid-template-columns: repeat(auto-fill, 84px);
  }
  .os-desktop-icon { width: 84px; }
  .os-desktop-icon__glyph { width: 46px; height: 46px; }
}

/* ============================================================
   OS SHELL — Profile-page polish: make the top header bar and the
   detail-hero "profile card" (equipment/project/task detail pages)
   read as a native OS window/app card, consistent with the taskbar
   and gadget sidebar's glass language.
   ============================================================ */

/* Top app bar: subtle glass + a cleaner bottom edge everywhere, matching
   the taskbar's frosted-glass material — theme-aware, so it's a light
   glass bar in light mode and a dark glass bar in dark mode, instead of
   being permanently dark regardless of the app's own theme. */
.screen:not(#screen-login):not(#screen-splash) > .app-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(248, 250, 252, .88)) !important;
  color: var(--os-ink, #16324f);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(20, 40, 60, .08) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5), 0 10px 24px rgba(20, 40, 60, .06) !important;
}
:root[data-theme="dark"] .screen:not(#screen-login):not(#screen-splash) > .app-header {
  background: linear-gradient(180deg, rgba(22, 40, 58, .97), rgba(14, 26, 38, .95)) !important;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 10px 24px rgba(0, 0, 0, .35) !important;
}
/* Contrast safety net — title/small text and icon buttons always readable
   against the header background, independent of --clr-text upstream. */
.screen:not(#screen-login):not(#screen-splash) > .app-header .header-title span {
  color: var(--os-ink, #16324f) !important;
}
.screen:not(#screen-login):not(#screen-splash) > .app-header .header-title small,
.screen:not(#screen-login):not(#screen-splash) > .app-header .btn-icon {
  color: var(--os-ink-soft, #6b7c8c) !important;
}
:root[data-theme="dark"] .screen:not(#screen-login):not(#screen-splash) > .app-header .header-title span {
  color: #fff !important;
}
:root[data-theme="dark"] .screen:not(#screen-login):not(#screen-splash) > .app-header .header-title small,
:root[data-theme="dark"] .screen:not(#screen-login):not(#screen-splash) > .app-header .btn-icon {
  color: rgba(255, 255, 255, .75) !important;
}

/* Detail hero — the profile-style card on equipment/project/task pages —
   gets the same sheen + depth treatment as the taskbar/gadget cards. */
.detail-hero {
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 22px 48px rgba(20, 40, 60, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}

/* Photo hero icon — styled like a native app/profile icon: rounded
   squircle, crisp border, real drop shadow instead of the flat box the
   default (non-photo) icon uses. */
.detail-hero-icon--photo {
  border-radius: 26%;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .08);
}

@media (max-width: 480px) {
  .detail-hero-icon--photo { border-radius: 24%; }
}

/* ============================================================
   OS SHELL — QR Scanner: live-camera visibility fix (was hidden
   behind the placeholder), plus richer scan feedback effects.
   ============================================================ */
.scanner-preview {
  border-radius: 18px;
  transition: box-shadow .25s ease;
}
.scanner-preview--live {
  box-shadow: 0 0 0 3px rgba(255, 107, 87, .35), 0 18px 40px rgba(20, 40, 60, .25);
}
.scanner-preview--flash {
  animation: osScanFlash .55s ease;
}
@keyframes osScanFlash {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, .65); }
  60% { box-shadow: 0 0 0 22px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.scanner-preview--live .scanner-corner {
  animation: osScanCornerPulse 1.6s ease-in-out infinite;
}
@keyframes osScanCornerPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

.scanner-success {
  animation: osScanSuccessPop .35s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes osScanSuccessPop {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.scanner-success-icon {
  animation: osGatePulse 1.4s ease-in-out infinite;
}

@media (max-width: 640px) {
  .scanner-frame { width: min(70vw, 220px); height: min(70vw, 220px); }
  .scanner-controls .btn { min-height: 48px; font-size: 15px; }
  .qr-tool-tabs { gap: 6px; }
}

/* ============================================================
   OS SHELL — Warehouse/Quotations: give the active view a flex column
   layout so its own scroll container (.wh-list/.q-list — already
   flex:1 1 auto; min-height:0; overflow-y:auto in css/style.css) can
   actually size itself against the header above it.
   IMPORTANT: .wh-view-shell itself must stay a plain flex column, NOT
   an overflow-y:auto container — nesting two scroll containers here
   (this one + .wh-list) is what was collapsing the cards on mobile in
   an earlier pass, since .wh-list can't measure its own height inside
   an ancestor that already has unconstrained scrollable height. ── */
#screen-warehouse .wh-view-shell:not(.hidden),
#screen-quotations .q-view-shell:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
#screen-warehouse .wh-view-shell:not(.hidden) > .app-header,
#screen-quotations .q-view-shell:not(.hidden) > .app-header {
  flex-shrink: 0;
}

/* ============================================================
   OS SHELL — Workspace Tools screen: full visual redesign as a
   responsive tile grid grouped into glass section cards, instead of a
   single flat vertical list. Pure presentation — every element id,
   class, and click handler is untouched, so nothing here can break
   functionality.
   ============================================================ */
/* layout-enhancer.js no longer injects this into #screen-tools (its
   grid-column:1/-1 was a no-op once .tools-menu became flex, and it was
   breaking the wrap of every tile after it) — this is a defensive
   fallback in case a stale cached copy of that script still runs it. */
#screen-tools .tools-menu > .page-context { display: none !important; }

#screen-tools .tools-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-items: stretch;
  max-width: 900px;
  margin-inline: auto;
  width: 100%;
  padding: 18px 16px calc(var(--os-taskbar-h, 60px) + 30px);
}

#screen-tools .tools-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 2px 10px;
  padding: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--os-ink-soft, #6b7c8c);
}
#screen-tools .tools-section-label:first-of-type { margin-top: 2px; }
#screen-tools .tools-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--clr-border, #e4ebf1), transparent);
}

/* Network status row stays a horizontal scroller of chips, not a tile. */
#screen-tools .net-mini-hud {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#screen-tools .net-mini-hud::-webkit-scrollbar { display: none; }
#screen-tools .net-chip { flex-shrink: 0; }

/* Section labels and the network-status row always span the full grid
   row width instead of being squeezed into a single tile cell — since
   section boundaries are just DOM order here (no wrapper divs per
   section), this is what keeps each section's tiles visually grouped
   under its own heading. */
#screen-tools .tools-menu > .tools-section-label,
#screen-tools .tools-menu > .net-mini-hud {
  grid-column: 1 / -1;
}

#screen-tools .tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
  padding: 16px;
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #e4ebf1);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(20, 40, 60, .06);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
#screen-tools .tool-card::before { display: none; } /* drop the old left accent bar — replaced by the icon tile's own color */
#screen-tools .tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(20, 40, 60, .12);
  border-color: rgba(255, 107, 87, .3);
}
#screen-tools .tool-card:active { transform: translateY(-1px); }

#screen-tools .tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
}
#screen-tools .tool-card-icon svg { width: 21px; height: 21px; }

#screen-tools .tool-card-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
#screen-tools .tool-card-copy strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--os-ink, #16324f);
}
#screen-tools .tool-card-copy small {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--os-ink-soft, #6b7c8c);
}

#screen-tools .tool-card-arrow {
  align-self: flex-end;
  margin-top: auto;
  width: 16px;
  height: 16px;
  color: var(--os-ink-soft, #6b7c8c);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .14s ease, transform .14s ease;
}
#screen-tools .tool-card:hover .tool-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* The App Status & Wake-Lock cards carry inline controls (buttons/switch)
   and are meaningfully taller than a simple nav tile — let them span the
   full row width instead of being squeezed into a grid cell. */
#screen-tools .tool-card[style*="cursor:default"] {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
}
#screen-tools .tool-card[style*="cursor:default"] .tool-card-copy { gap: 2px; }

#screen-tools .tool-card--danger {
  border-color: rgba(220, 38, 38, .25);
  background: rgba(220, 38, 38, .04);
}
#screen-tools .tool-card--danger:hover {
  border-color: rgba(220, 38, 38, .5);
  box-shadow: 0 16px 32px rgba(220, 38, 38, .14);
}

@media (max-width: 640px) {
  #screen-tools .tools-menu {
    grid-template-columns: 1fr;
    padding: 14px 12px calc(var(--os-taskbar-h, 56px) + 24px);
  }
  #screen-tools .tool-card[style*="cursor:default"] {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   OS SHELL — Enlarge Tools/Settings and Warehouse cards; fix real
   clipping bugs found in each, not just make things visually bigger.
   ============================================================ */

/* ── Tools screen: the grid redesign's align-items:stretch forced every
   row to the height of its tallest card, and .tool-card's base rule
   (css/style.css) has overflow:hidden — on a row measured shorter than a
   card's actual content, its own text got clipped. Switch to natural,
   content-driven card height (align-items:start) and open the overflow
   back up, then genuinely enlarge everything as asked. ── */
#screen-tools .tools-menu {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: start;
}
#screen-tools .tool-card {
  overflow: visible !important;
  height: auto;
  min-height: 128px;
  padding: 20px;
  gap: 12px;
}
#screen-tools .tool-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
}
#screen-tools .tool-card-icon svg { width: 24px; height: 24px; }
#screen-tools .tool-card-copy strong {
  font-size: 15px;
  line-height: 1.35;
}
#screen-tools .tool-card-copy small {
  font-size: 12.5px;
  line-height: 1.55;
}

@media (max-width: 640px) {
  #screen-tools .tool-card {
    min-height: 116px;
    padding: 18px;
  }
}

/* ── Warehouse cards: the description was hard-clamped to 3 lines with
   no ellipsis, so longer text just cut off mid-sentence looking broken.
   Give clamped text room to breathe and bump the overall card/text size. ── */
#screen-warehouse .wh-project-card,
#screen-quotations :is(.quotation-project-card, .quotation-item) {
  min-height: 190px !important;
  padding: 20px 22px !important;
}
#screen-warehouse .wh-item-card {
  min-height: 250px !important;
}
#screen-warehouse .wh-item-card__body {
  padding: 20px !important;
}
#screen-warehouse .wh-project-card__name,
#screen-warehouse .wh-item-card__name {
  font-size: 16px !important;
  line-height: 1.45 !important;
}
#screen-warehouse .wh-item-card__desc {
  -webkit-line-clamp: 5 !important;
  font-size: 13px !important;
  line-height: 1.7 !important;
}

@media (max-width: 640px) {
  #screen-warehouse .wh-item-card { min-height: 220px !important; }
  #screen-warehouse .wh-item-card__body { padding: 17px !important; }
}

/* ============================================================
   OS SHELL — Tools/Settings + Warehouse cards, larger again on mobile.
   ============================================================ */
@media (max-width: 640px) {
  #screen-tools .tool-card {
    min-height: 152px !important;
    padding: 22px !important;
    gap: 14px !important;
  }
  #screen-tools .tool-card-icon {
    width: 58px !important;
    height: 58px !important;
    border-radius: 16px !important;
  }
  #screen-tools .tool-card-icon svg { width: 27px !important; height: 27px !important; }
  #screen-tools .tool-card-copy strong {
    font-size: 16.5px !important;
    line-height: 1.4 !important;
  }
  #screen-tools .tool-card-copy small {
    font-size: 13.5px !important;
    line-height: 1.6 !important;
  }

  #screen-warehouse .wh-item-card { min-height: 270px !important; }
  #screen-warehouse .wh-project-card { min-height: 210px !important; }
  #screen-warehouse .wh-item-card__body { padding: 20px !important; }
  #screen-warehouse .wh-project-card__name,
  #screen-warehouse .wh-item-card__name {
    font-size: 17px !important;
    line-height: 1.5 !important;
  }
  #screen-warehouse .wh-item-card__desc {
    -webkit-line-clamp: 6 !important;
    font-size: 14px !important;
    line-height: 1.75 !important;
  }
  #screen-warehouse .wh-item-card__actions .btn-icon {
    width: 46px !important;
    height: 46px !important;
  }
}

/* ============================================================
   OS SHELL — Warehouse & Tools screens ONLY: true desktop-icon-grid
   look (icon + label, centered, no card chrome) instead of detail
   cards. Strictly scoped to #screen-warehouse and #screen-tools so
   nothing else in the app is affected. Every element stays in the DOM
   and every click handler keeps working — this only hides secondary
   detail (descriptions/stats/badges) visually and reveals it back on
   hover, so no functionality is lost, just decluttered.
   ============================================================ */

/* ── Tools & Settings: icon + title only, no description card ──
   .tools-menu also carries the base .form-container class, whose rule
   (style.css) sets flex-direction:column. Without an explicit row here,
   that column direction was inherited — combined with flex-wrap:wrap it
   produced a multi-COLUMN layout (items stacking top-to-bottom, then
   wrapping sideways into new columns) instead of the intended
   left-to-right, row-wrapping icon grid. */
#screen-tools .tools-menu {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: center;
  align-content: flex-start;
  align-items: flex-start !important;
  gap: 6px 4px;
  max-width: 1000px;
  height: auto !important;
  min-height: 0 !important;
  /* .tools-menu IS .form-container (same element) — that base class is
     what OWNS this screen's scrolling (overflow-y:auto). An earlier
     "overflow: visible !important" here to stop icon clipping
     accidentally killed that scrollbar too; scope visibility to X only
     and keep Y scrollable. */
  overflow-x: visible !important;
  overflow-y: auto !important;
  padding-bottom: calc(var(--os-taskbar-h, 60px) + 40px) !important;
}
#screen-tools .tools-section-label {
  width: 100%;
  flex-basis: 100%;
  justify-content: center;
  text-align: center;
}
#screen-tools .tools-section-label::after { display: none; }
#screen-tools .net-mini-hud { flex-basis: 100%; justify-content: center; }

#screen-tools .tool-card {
  width: 104px;
  min-height: 0 !important;
  height: auto !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center;
  gap: 6px !important;
  padding: 12px 6px !important;
  /* A faint tint by default (not fully transparent) so each icon tile
     reads as a distinct, tappable area even without hover — touch
     devices never see :hover, so a hover-only reveal left tiles looking
     like plain unstyled icons+text on mobile. */
  background: rgba(22, 50, 79, .035) !important;
  border: 1px solid rgba(22, 50, 79, .05) !important;
  box-shadow: none !important;
  border-radius: 14px;
}
#screen-tools .tool-card:hover,
#screen-tools .tool-card:active {
  transform: none;
  background: rgba(22, 50, 79, .08) !important;
  box-shadow: none !important;
}
#screen-tools .tool-card-icon {
  width: 52px !important;
  height: 52px !important;
  border-radius: 15px !important;
}
#screen-tools .tool-card-copy strong {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1.3;
}
/* Descriptions stay in the DOM (accessible to screen readers / hover
   tooltip) but aren't part of the icon's default visual — real desktop
   icons don't show a paragraph under every icon. */
#screen-tools .tool-card-copy small {
  display: none;
}
#screen-tools .tool-card-arrow { display: none; }
/* The two informational cards (App Status, Wake Lock) carry real inline
   controls (buttons/switch) — those stay as compact full-width rows,
   not icon tiles, since they aren't "open something" actions. */
#screen-tools .tool-card[style*="cursor:default"] {
  width: 100%;
  flex-basis: 100%;
  flex-direction: row !important;
  align-items: center !important;
  text-align: left;
  background: var(--clr-surface, #fff) !important;
  border: 1px solid var(--clr-border, #e4ebf1) !important;
  border-radius: 16px;
  padding: 16px !important;
}
#screen-tools .tool-card[style*="cursor:default"] .tool-card-copy small {
  display: block;
}

@media (max-width: 640px) {
  #screen-tools .tool-card { width: 92px; }
  #screen-tools .tool-card-icon { width: 48px !important; height: 48px !important; }
  #screen-tools .tool-card-copy strong { font-size: 11px !important; }
}

/* ── Warehouse: project tiles become folder icons, item tiles become
   plain icon+label — same collapse-to-icon treatment. These lists also
   carry the base .pg-list class, whose rule (style.css) sets
   flex-direction:column — without an explicit row override that was
   winning, turning the wrap into vertical-stacking-then-side-columns
   instead of the intended horizontal icon grid (same bug as Tools). ── */
#screen-warehouse #wh-projects-list.wh-project-list,
#screen-warehouse #wh-items-list.wh-items-list {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: center;
  align-content: flex-start;
  align-items: flex-start !important;
  gap: 18px 12px;
  padding: 20px 12px calc(var(--os-taskbar-h, 60px) + 40px) !important;
  height: auto !important;
  min-height: 0 !important;
  /* These elements also carry .wh-list, which OWNS this view's scrolling
     (overflow-y:auto, style.css) — an earlier "overflow: visible
     !important" here to stop icon clipping accidentally killed that
     scrollbar too; scope visibility to X only and keep Y scrollable. */
  overflow-x: visible !important;
  overflow-y: auto !important;
}

/* Project "folder" tile — selectors also carry .os-folder-envelope so
   they out-specificity the pre-existing "Folder Envelope" card design in
   operational-ui-polish.css (#screen-warehouse .wh-project-card.os-folder-envelope),
   which was otherwise winning the cascade and leaving a full-size,
   mostly-empty card shell instead of a compact icon tile. Every value is
   !important for the same reason — that file marks nearly everything
   !important too, and without matching that, non-important values here
   lose regardless of specificity. */
#screen-warehouse .wh-project-card.os-folder-envelope {
  width: 112px !important;
  min-height: 0 !important;
  padding: 8px 6px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  gap: 6px !important;
  /* Faint default tint so tiles read as tappable areas on touch devices
     too, not just on :hover (same reasoning as the Tools icon grid). */
  background: rgba(22, 50, 79, .035) !important;
  border: 1px solid rgba(22, 50, 79, .05) !important;
  box-shadow: none !important;
  border-radius: 12px !important;
  overflow: visible !important;
}
#screen-warehouse .wh-project-card.os-folder-envelope:hover,
#screen-warehouse .wh-project-card.os-folder-envelope:active {
  background: rgba(22, 50, 79, .08) !important;
  transform: none !important;
  box-shadow: none !important;
}
#screen-warehouse .wh-project-top { width: 100% !important; }
#screen-warehouse .wh-project-tab-header,
#screen-warehouse .wh-project-stats-grid,
#screen-warehouse .wh-stock-track,
#screen-warehouse .wh-project-footer,
#screen-warehouse .wh-project-sub {
  display: none !important;
}
#screen-warehouse .wh-project-header-row {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
}
#screen-warehouse .wh-project-icon-box {
  position: relative !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 6px 12px 12px 12px !important;
  background: linear-gradient(135deg, #ffd166, #ffb703) !important;
  color: rgba(0, 0, 0, .45) !important;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .08) !important;
}
#screen-warehouse .wh-health-dot {
  position: absolute !important;
  top: auto !important;
  bottom: -2px !important;
  right: -2px !important;
  width: 12px !important;
  height: 12px !important;
  border: 2px solid var(--clr-bg, #eaf1f8) !important;
  border-radius: 50% !important;
}
#screen-warehouse .wh-project-title-box { width: 100% !important; flex: none !important; }
#screen-warehouse .wh-project-name {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  overflow: visible !important;
  text-overflow: clip !important;
  margin: 0 !important;
}
#screen-warehouse .wh-project-quick-actions {
  display: flex !important;
  gap: 2px !important;
  opacity: 0;
  transition: opacity .12s ease;
}
#screen-warehouse .wh-project-card:hover .wh-project-quick-actions,
#screen-warehouse .wh-project-card:focus-within .wh-project-quick-actions {
  opacity: 1;
}

/* Item icon tile */
#screen-warehouse .wh-item-card {
  width: 108px;
  min-height: 0 !important;
  padding: 0 !important;
  background: rgba(22, 50, 79, .035) !important;
  border: 1px solid rgba(22, 50, 79, .05) !important;
  box-shadow: none !important;
  border-radius: 12px;
  overflow: hidden !important;
}
#screen-warehouse .wh-item-card:hover,
#screen-warehouse .wh-item-card:active {
  background: rgba(22, 50, 79, .08) !important;
}
#screen-warehouse .wh-item-header {
  display: flex !important;
  flex-direction: column !important;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 10px 6px !important;
}
#screen-warehouse .wh-item-thumb-wrapper,
#screen-warehouse .wh-item-thumb-wrapper img,
#screen-warehouse .wh-item-icon-placeholder {
  width: 52px !important;
  height: 52px !important;
  border-radius: 12px !important;
}
#screen-warehouse .wh-item-main-info {
  display: flex !important;
  flex-direction: column !important;
  align-items: center;
  gap: 4px;
  width: 100%;
}
#screen-warehouse .wh-item-top-row {
  display: none !important;
}
#screen-warehouse .wh-item-title {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  white-space: normal;
  margin: 0;
}
#screen-warehouse .wh-item-body-grid,
#screen-warehouse .wh-item-details-box {
  display: none !important;
}
#screen-warehouse .wh-item-card-enhanced .wh-item-actions-bar {
  display: flex !important;
  justify-content: center;
  gap: 2px;
  padding: 0 6px 8px !important;
  opacity: 0;
  transition: opacity .12s ease;
}
#screen-warehouse .wh-item-card:hover .wh-item-actions-bar,
#screen-warehouse .wh-item-card:focus-within .wh-item-actions-bar {
  opacity: 1;
}
#screen-warehouse .btn-wh-action span { display: none; }

@media (max-width: 640px) {
  #screen-warehouse .wh-project-card,
  #screen-warehouse .wh-item-card { width: 92px; }
  #screen-warehouse .wh-project-icon-box,
  #screen-warehouse .wh-item-thumb-wrapper,
  #screen-warehouse .wh-item-thumb-wrapper img,
  #screen-warehouse .wh-item-icon-placeholder { width: 48px !important; height: 48px !important; }
  /* No hover on touch — keep secondary actions reachable at all times. */
  #screen-warehouse .wh-project-quick-actions,
  #screen-warehouse .wh-item-card-enhanced .wh-item-actions-bar {
    opacity: 1;
  }
}
