.dash-chart-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #d8e0ec;
  --border: #d8e0ec;
  --primary: #2457d6;
  --primary-dark: #163fa6;
  --accent: #12a87f;
  --green: #18a058;
  --red: #d92d20;
  --yellow: #f4b740;
  --blue: #2f80ed;
  --gray: #667085;
  --shadow: 0 16px 40px rgba(61, 31, 31, 0.08);
  --radius: 18px;
  --vm-section-th-bg: #ffe566;
  --vm-section-th-border: #e6c200;
  --vm-section-th-text: #21314d;
  --vm-section-td-bg: #fff9c4;
  --vm-section-td-even-bg: #fff3a0;
  --vm-section-td-hover-bg: #ffef80;
  --vm-section-edge: #f9a825;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: clip;
}

html {
  overflow-x: clip;
  max-width: 100%;
}

body.dark {
  --bg: #0f172a;
  --panel: #111c31;
  --panel-soft: #17223a;
  --text: #f8fafc;
  --muted: #a7b0c0;
  --line: #2d3a52;
  --border: #2d3a52;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  --vm-section-th-bg: #3a3318;
  --vm-section-th-border: #6b5a1a;
  --vm-section-th-text: #fef3c7;
  --vm-section-td-bg: #1a2210;
  --vm-section-td-even-bg: #1f2a14;
  --vm-section-td-hover-bg: #283218;
  --vm-section-edge: #ca8a04;
}

.login-screen {
  position: relative;
  z-index: 200;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  pointer-events: auto;
  background:
    radial-gradient(circle at 12% 18%, rgba(36, 87, 214, 0.22), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(18, 168, 127, 0.16), transparent 38%),
    linear-gradient(160deg, color-mix(in srgb, var(--primary) 8%, var(--bg)), var(--bg));
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 26px;
  letter-spacing: 0;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-field input {
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.login-field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid rgba(217, 45, 32, 0.25);
  border-radius: 12px;
  background: rgba(217, 45, 32, 0.08);
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.login-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px rgba(36, 87, 214, 0.28);
  overflow: hidden;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.login-tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.login-server-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-server-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  flex: 0 0 auto;
}

.login-server-dot.is-checking {
  background: var(--yellow);
  animation: login-pulse 1.2s ease-in-out infinite;
}

.login-server-dot.is-online {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 160, 88, 0.18);
}

.login-server-dot.is-offline {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.16);
}

.login-version {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@keyframes login-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.app-shell {
  min-height: 100vh;
  padding: 0;
}

.app-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  gap: 0;
  align-items: stretch;
  min-width: 0;
}

.app-layout.sidebar-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 100vh;
  max-height: 100dvh;
  padding: 10px 10px;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
  box-shadow: none;
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.app-sidebar-logo {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #0f172a));
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  overflow: hidden;
}

.app-sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.app-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.app-sidebar-brand-text strong {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.app-sidebar-brand-text span {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-sidebar-collapse-btn {
  min-width: 26px;
  padding: 4px 6px;
  line-height: 1;
  flex: 0 0 auto;
}

.app-sidebar-nav {
  display: grid;
  gap: 2px;
  align-content: start;
  grid-auto-rows: min-content;
  overflow: auto;
  padding-right: 2px;
  flex: 1 1 auto;
  min-height: 0;
}

.app-sidebar-divider {
  height: 1px;
  margin: 4px 4px;
  background: var(--line);
}

.app-sidebar-footer {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.app-sidebar-logout:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 22%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}

.app-sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-sidebar-link:hover {
  transform: none;
  background: color-mix(in srgb, var(--primary) 8%, var(--panel));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
}

.app-sidebar-link.is-active {
  background: color-mix(in srgb, var(--primary) 14%, var(--panel));
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  color: var(--primary);
}

.app-sidebar-icon {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1;
}

.app-sidebar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-layout.sidebar-collapsed .app-sidebar-brand-text,
.app-layout.sidebar-collapsed .app-sidebar-label,
.app-layout.sidebar-collapsed .app-sidebar-divider {
  display: none;
}

.app-layout.sidebar-collapsed .app-sidebar-brand {
  justify-content: center;
  padding-inline: 0;
}

.app-layout.sidebar-collapsed .app-sidebar-link {
  justify-content: center;
  padding-inline: 8px;
}

.app-layout.sidebar-collapsed .app-sidebar-collapse-btn {
  transform: rotate(180deg);
}

.app-content {
  min-width: 0;
  padding: 22px;
}

.app-content main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.app-content main > section,
.app-content #operationalSheetsSection {
  scroll-margin-top: 92px;
}

.app-sidebar-open-btn {
  display: none;
  min-width: 38px;
  padding: 8px 10px;
  line-height: 1;
  font-size: 16px;
}

.app-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 36;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.app-sidebar-backdrop[hidden] {
  display: none !important;
}

body.dark .app-sidebar {
  background: color-mix(in srgb, var(--panel) 88%, #000);
}

body.dark .app-sidebar-backdrop {
  background: rgba(2, 6, 23, 0.62);
}

.app-bottom-nav {
  display: none;
}

.app-bottom-nav-btn {
  display: grid;
  gap: 2px;
  justify-items: center;
  align-content: center;
  min-height: 58px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
}

.app-bottom-nav-btn.is-active {
  color: var(--primary);
}

.app-bottom-nav-icon {
  font-size: 16px;
  line-height: 1;
}

.app-bottom-nav-label {
  letter-spacing: 0.02em;
}

@media (min-width: 961px) and (max-width: 1280px) {
  .app-layout:not(.sidebar-collapsed) {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .app-layout:not(.sidebar-collapsed) .app-sidebar-brand-text,
  .app-layout:not(.sidebar-collapsed) .app-sidebar-label,
  .app-layout:not(.sidebar-collapsed) .app-sidebar-divider {
    display: none;
  }

  .app-layout:not(.sidebar-collapsed) .app-sidebar-brand {
    justify-content: center;
    padding-inline: 0;
  }

  .app-layout:not(.sidebar-collapsed) .app-sidebar-link {
    justify-content: center;
    padding-inline: 8px;
  }

  .app-layout:not(.sidebar-collapsed) .app-sidebar-collapse-btn {
    display: none;
  }
}

@media (max-width: 960px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-sidebar-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(248px, 82vw);
    max-height: none;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .app-layout.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }

  .app-sidebar-collapse-btn {
    display: none;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px 18px;
  margin: -22px -22px 22px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-logo-img {
  max-width: 100%;
  max-height: 100%;
}

.topbar-brand h1 {
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.1;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.topbar-menus {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-menu {
  position: relative;
}

.topbar-menu-toggle {
  white-space: nowrap;
}

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(280px, 42vw);
}

.role-pill-compact {
  min-height: 0;
  padding: 6px 10px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-caret {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.topbar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 6px;
  min-width: 200px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar-menu-panel[hidden] {
  display: none !important;
}

.topbar-menu-panel-user {
  min-width: 220px;
}

.topbar-menu-user-meta {
  display: grid;
  gap: 2px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.topbar-menu-user-meta strong {
  font-size: 13px;
}

.topbar-menu-user-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.topbar-menu-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.topbar-menu-item.primary-btn,
.topbar-menu-item.accent {
  box-shadow: none;
}

body.dark .topbar {
  background: rgba(15, 23, 42, 0.84);
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: -0.04em;
}

h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.topbar-actions, .session-actions, .pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  flex: 0 1 auto;
}

.session-actions {
  flex: 1 1 520px;
  justify-content: flex-end;
  min-width: 0;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 39px;
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.upload-time-pill {
  display: inline-flex;
  align-items: center;
  min-height: 39px;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(18, 168, 127, 0.08);
  border: 1px solid rgba(18, 168, 127, 0.25);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

button, .primary-btn, .ghost-btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover, .primary-btn:hover, .ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 11px 15px;
  box-shadow: 0 10px 20px rgba(36, 87, 214, 0.18);
}

.primary-btn.accent {
  background: linear-gradient(135deg, #12a87f, #0f8d6d);
}

.ghost-btn, .pagination-controls button {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 14px;
}

.refresh-btn {
  color: var(--primary);
}

main {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.section-card, .kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.section-card {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.status-pill, .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.dash-hub-card {
  padding: 12px 14px;
}

.dash-hub {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.dash-heads {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
}

.dash-head {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 10px 10px 6px;
  min-height: 108px;
  max-height: 120px;
  display: grid;
  grid-template-rows: auto auto auto 28px;
  gap: 2px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dash-head:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.dash-head.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.14);
}

.dash-head-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-head-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.dash-head-status .dash-head-icon { background: rgba(34, 197, 94, 0.14); color: var(--green); }
.dash-head-working .dash-head-icon { background: rgba(59, 130, 246, 0.14); color: var(--blue); }
.dash-head-oqt .dash-head-icon { background: rgba(249, 115, 22, 0.14); color: #c2410c; }
.dash-head-pqt .dash-head-icon { background: rgba(168, 85, 247, 0.14); color: #7e22ce; }

.dash-head-title {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.dash-head-value {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.dash-head-delta {
  font-size: 10px;
  font-weight: 800;
}

.dash-head-delta.up { color: var(--green); }
.dash-head-delta.down { color: var(--red); }
.dash-head-delta.flat { color: var(--muted); }

.dash-head-spark {
  min-height: 28px;
  width: 100%;
}

.dash-expand {
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  animation: dash-expand-in 0.28s ease;
}

.dash-expand[hidden] {
  display: none !important;
}

@keyframes dash-expand-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash-expand-inner {
  padding: 14px;
}

.dash-expand-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.dash-expand-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dash-expand-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-expand-grid.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-metric-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.dash-metric-card h4 {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.dash-metric-card strong {
  font-size: 20px;
  font-weight: 900;
}

.dash-metric-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.dash-chart-block {
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.dash-chart-block h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
}

.dash-chart-panel {
  min-height: 220px;
}

.dash-chart-panel.tall {
  min-height: 260px;
}

.dash-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dash-hub-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.dash-hub-updated {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.dash-hub-empty {
  margin: 0;
  padding: 10px 14px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--green);
}

.status-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: status-live-pulse 1.4s ease-in-out infinite;
}

@keyframes status-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.status-updated {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.status-refresh-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.status-refresh-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.danger-btn {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
}

.danger-btn:hover {
  background: rgba(239, 68, 68, 0.12);
}

.data-input-heading,
.history-heading {
  align-items: center;
}

.data-input-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.section-toggle,
.history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.section-toggle-icon,
.history-toggle-icon {
  font-size: 12px;
  line-height: 1;
}

.data-input-body {
  overflow: hidden;
  max-height: 1400px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
}

.history-body {
  overflow: hidden;
  max-height: 520px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
}

.data-input-card.is-collapsed .data-input-body,
.history-card.is-collapsed .history-body,
.transfer-data-table-card.is-collapsed .operational-table-body,
#operationalSheetsSection .table-card.is-collapsed .operational-table-body,
#operationalSheet2Card.is-collapsed .operational-table-body {
  flex: 0 0 auto;
  max-height: 0 !important;
  opacity: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  overflow: hidden;
}

.operational-table-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease, flex 0.35s ease;
}

#operationalSheetsSection .operational-sheet-header {
  position: sticky;
  top: 68px;
  z-index: 20;
  flex: 0 0 auto;
  background: var(--panel);
  padding-bottom: 8px;
  margin-bottom: 8px;
  box-shadow: 0 1px 0 var(--line);
}

#operationalSheetsSection .operational-sheet-header-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

#operationalSheetsSection .operational-table-title {
  cursor: pointer;
  min-width: 0;
  flex: 1 1 auto;
}

#operationalSheetsSection .operational-table-title h2 {
  margin: 0;
}

#operationalSheetsSection .operational-table-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
  color: var(--primary);
  padding: 10px 16px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#operationalSheetsSection .operational-table-toggle:hover {
  background: color-mix(in srgb, var(--primary) 20%, var(--panel));
}

#operationalSheetsSection .operational-table-toggle-icon {
  font-size: 12px;
  line-height: 1;
}

#operationalSheetsSection .operational-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

#operationalSheetsSection .table-card.is-collapsed .operational-sheet-header {
  box-shadow: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

#operationalSheetsSection .table-card.is-collapsed .operational-table-toolbar {
  display: none !important;
}

.operational-table-heading .resize-controls {
  align-items: center;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.history-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.history-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.history-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-metrics em {
  font-style: normal;
  color: var(--text);
  margin-right: 4px;
}

.history-total {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 16px;
}

.match-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.match-status.success {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--green);
}

.match-status.warning {
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--yellow);
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 20px;
  text-align: center;
  border: 2px dashed #abc0e8;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(36, 87, 214, 0.06), transparent);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.drop-zone:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.drop-zone input {
  display: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: #e9efff;
  color: var(--primary);
  font-size: 30px;
  font-weight: 900;
}

.purchase-zone {
  border-color: rgba(18, 168, 127, 0.42);
  background: linear-gradient(180deg, rgba(18, 168, 127, 0.08), transparent);
}

.purchase-zone .drop-icon {
  background: rgba(18, 168, 127, 0.12);
  color: var(--accent);
}

.vm-gandola-zone {
  border-color: rgba(124, 58, 237, 0.42);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.08), transparent);
}

.vm-gandola-zone .drop-icon {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.stkot-zone {
  border-color: rgba(47, 128, 237, 0.42);
  background: linear-gradient(180deg, rgba(47, 128, 237, 0.08), transparent);
}

.stkot-zone .drop-icon {
  background: rgba(47, 128, 237, 0.12);
  color: var(--blue);
}

.paste-box {
  display: grid;
  gap: 10px;
}

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 11px 12px;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 87, 214, 0.1);
}

textarea {
  min-height: 125px;
  resize: vertical;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 14px;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.6fr) minmax(220px, 0.9fr);
  gap: 16px;
}

.overview-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.overview-subhead {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.overview-kpis-panel .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.overview-kpis-panel .kpi-card {
  padding: 12px;
}

.overview-kpis-panel .kpi-value {
  font-size: 20px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.kpi-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(36, 87, 214, 0.08);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.filter-section-heading .ghost-btn {
  flex-shrink: 0;
  align-self: center;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(8, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.filter-grid > * {
  min-width: 0;
}

#operationalSheet2Card #gtFiltersCard {
  margin: 0 0 8px !important;
  padding: 6px 8px !important;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.analytics-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.analytics-grid.table-only {
  grid-template-columns: minmax(0, 1fr);
}

#operationalSheetsSection {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  min-height: calc(100dvh - 150px);
  --operational-visible-rows: 20;
  --operational-row-height: 28px;
  --operational-head-height: 36px;
  --operational-card-chrome: 128px;
}

.analytics-grid.table-only .table-card {
  grid-column: 1 / -1;
}

.insight-list, .alert-list {
  display: grid;
  gap: 10px;
}

.insight-item, .alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.insight-item span, .alert-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#operationalSheetsSection .table-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  width: 100% !important;
  max-width: 100%;
  min-height: calc(var(--operational-card-chrome) + var(--operational-head-height) + (var(--operational-visible-rows) * var(--operational-row-height)));
  height: auto !important;
  max-height: none;
  overflow: hidden;
}

#operationalSheetsSection .table-card.is-collapsed {
  flex: 0 0 auto;
  height: auto !important;
  min-height: 0;
  max-height: none;
}

#operationalSheetsSection .table-card.is-collapsed .operational-sheet-header {
  margin-bottom: 0;
}

#operationalSheetsSection .table-card .operational-sheet-header {
  flex-shrink: 0;
}

.table-card.table-floating {
  position: relative;
  z-index: auto;
  max-width: 100%;
  margin: 0;
  box-shadow: var(--shadow);
}

.table-drag-handle {
  cursor: default;
  user-select: none;
}

#operationalSheetsSection .section-heading {
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

#operationalSheetsSection .section-heading.compact {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(440px, 1fr) auto;
  grid-template-areas: "title pagination actions";
  align-items: center;
  column-gap: 16px;
  row-gap: 10px;
  margin-bottom: 12px;
}

#operationalSheetsSection .section-heading.compact > div:first-child {
  grid-area: title;
  min-width: 0;
}

#operationalSheetsSection .section-heading.compact h2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#operationalSheetsSection .section-heading.compact .pagination-controls.top-controls {
  grid-area: pagination;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

#operationalSheetsSection .section-heading.compact .pagination-controls.top-controls span {
  flex: 0 0 11.5rem;
  min-width: 11.5rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

#operationalSheetsSection .section-heading.compact .resize-controls {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}

#operationalSheetsSection .section-heading.compact .resize-controls button,
#operationalSheetsSection .section-heading.compact .pagination-controls.top-controls button {
  white-space: nowrap;
}

#operationalSheet2Card .vm-tdt-btn {
  min-width: 52px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#operationalSheet2Card .vm-tdt-btn:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

#operationalSheet2Card .vm-table-toolbar {
  flex-wrap: wrap;
}

#operationalSheetsSection .table-wrap,
#operationalSheetsSection .table-wrapper {
  position: relative;
  flex: 1 1 0;
  min-height: calc(var(--operational-head-height) + (var(--operational-visible-rows) * var(--operational-row-height)));
  min-width: 0;
  overflow-x: scroll;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  border: 1px solid var(--line);
  border-radius: 14px;
  isolation: isolate;
}

.table-floating .table-wrap {
  height: calc(100% - 82px);
  max-height: none;
}

.table-resize-handle {
  display: none;
}

body.table-moving,
body.table-resizing,
body.column-resizing {
  user-select: none;
}

body.table-moving {
  cursor: move;
}

body.table-resizing {
  cursor: nwse-resize;
}

body.column-resizing {
  cursor: col-resize;
}

body.row-resizing {
  cursor: row-resize;
  user-select: none;
}

.table-card.table-size-small {
  width: 100% !important;
}

.table-card.table-size-wide {
  width: 100% !important;
}

#operationalSheetsSection .table-card.table-size-full {
  position: relative;
  inset: auto;
  z-index: auto;
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
  max-height: none;
  min-height: calc(var(--operational-card-chrome) + var(--operational-head-height) + (var(--operational-visible-rows) * var(--operational-row-height)));
}

#operationalSheetsSection .table-card.table-size-full.is-collapsed {
  flex: 0 0 auto;
  height: auto !important;
  min-height: 0;
  max-height: none;
}

#operationalSheetsSection .table-card.table-size-full .table-wrap,
#operationalSheetsSection .table-card.table-size-full .table-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.table-card.table-size-full .table-wrap {
  height: calc(100% - 82px);
  max-height: none;
}

.resize-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#sizeSmall,
#sizeWide,
#sizeFull {
  display: inline-flex;
}

.resize-controls button {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
}

.resize-controls button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#toggleHiddenFields {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

#toggleHiddenFields:hover {
  color: #fff;
  filter: brightness(0.95);
}

.pivot-panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.pivot-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pivot-panel-toolbar strong {
  color: var(--text);
  font-weight: 900;
}

.pivot-panel-toolbar div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pivot-panel-toolbar button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  font-weight: 800;
  cursor: pointer;
}

.pivot-fields,
.pivot-fields-container {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-height: min(42vh, 380px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  align-content: start;
}

.pivot-field,
.pivot-field-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  min-width: 0;
  width: 100%;
}

.pivot-field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.pivot-field-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.pivot-field-check span {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.main-table,
table {
  min-width: 0;
  width: max-content;
  table-layout: auto;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 11px;
}

.main-table th,
.main-table td,
th,
td {
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  min-width: 0;
}

.main-table th:last-child,
.main-table td:last-child {
  padding-right: 40px;
}

th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #edf3ff;
  color: #21314d;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  overflow: visible;
  vertical-align: middle;
}

.main-table th {
  padding-right: 12px;
  min-width: 0 !important;
}

.main-table td {
  line-height: 1.2;
}

#operationalSheetsSection .main-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: max-content;
  table-layout: fixed;
  font-size: 10.5px;
}

#operationalSheetsSection .main-table thead {
  background: var(--panel);
}

#operationalSheetsSection .main-table th,
#operationalSheetsSection .main-table td {
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 48px;
  max-width: none;
  box-sizing: border-box;
  padding: 5px 7px;
  line-height: 1.15;
}

#operationalSheetsSection .main-table th {
  min-width: 48px !important;
}

#operationalSheetsSection .main-table th[data-key] {
  cursor: pointer;
  background: #edf3ff;
  box-shadow: inset 0 -1px 0 var(--line);
}

#operationalSheetsSection .th-sort-label span {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#operationalSheetsSection .th-sort-label,
#operationalSheetsSection .th-sort-label span {
  text-align: center;
  pointer-events: none;
}

#operationalSheetsSection .column-filter,
#operationalSheetsSection .th-content {
  overflow: visible;
}

#operationalSheetsSection .th-sort-label {
  flex: 1 1 auto;
  width: auto;
  overflow: visible;
  text-overflow: clip;
}

#operationalSheetsSection .th-sort-label span {
  display: inline-block;
  width: auto;
  overflow: visible;
  text-overflow: clip;
}

#operationalSheetsSection .column-filter-toggle {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 70;
  touch-action: none;
}

.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(33, 49, 77, 0.18);
}

th.filter-open {
  z-index: 40;
}

.column-filter {
  position: relative;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.th-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.th-sort-label {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

  .th-sort-label span {
    display: block;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    overflow: hidden;
    min-width: 0;
    width: 100%;
  }

.column-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(33, 49, 77, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  color: #21314d;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.column-filter-toggle.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.th-sort-label:hover,
.column-filter-toggle:hover {
  transform: none;
}

.column-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(260px, 82vw);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
  cursor: default;
}

th:last-child .column-filter-menu {
  right: 0;
  left: auto;
}

.column-filter-title,
.column-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.column-filter-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.column-filter-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.column-filter-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 900;
}

.column-filter-actions button:hover {
  transform: none;
  border-color: var(--primary);
  color: var(--primary);
}

.column-filter-options {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.column-filter-search-wrap {
  display: block;
}

.column-filter-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 9px;
}

.column-filter-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.12);
}

.column-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.column-filter-option input {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.column-filter-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-filter-empty {
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

body.dark #operationalSheetsSection .main-table th[data-key] {
  background: #1e293b;
  box-shadow: inset 0 -1px 0 var(--line);
}

body.dark th {
  background: #1d2a44;
  color: #f8fafc;
}

tbody tr:nth-child(even) td {
  background: rgba(148, 163, 184, 0.06);
}

tbody tr:hover td {
  background: rgba(36, 87, 214, 0.08);
}

#operationalSheetsSection .main-table th.sticky-col,
#operationalSheetsSection .main-table td.sticky-col {
  position: sticky;
  background: var(--panel);
  background-clip: padding-box;
  isolation: isolate;
  border-right: none;
}

#operationalSheetsSection .main-table thead th.sticky-col {
  z-index: 40;
  background: #edf3ff;
  background-clip: padding-box;
}

#operationalSheetsSection .main-table tbody td.sticky-col {
  z-index: 20;
}

#operationalSheetsSection .main-table thead th.sticky-col.sticky-col-edge {
  z-index: 50;
}

#operationalSheetsSection .main-table th.sticky-col-edge,
#operationalSheetsSection .main-table td.sticky-col-edge {
  overflow: visible;
  border-right: 1px solid var(--line);
}

#operationalSheetsSection .main-table tbody tr:nth-child(even) td.sticky-col {
  background: color-mix(in srgb, var(--panel) 94%, var(--line));
  background-clip: padding-box;
}

#operationalSheetsSection .main-table tbody tr:hover td.sticky-col {
  background: color-mix(in srgb, var(--primary) 8%, var(--panel));
  background-clip: padding-box;
}

#operationalSheetsSection .main-table th.sticky-col-edge::after,
#operationalSheetsSection .main-table td.sticky-col-edge::after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  width: 8px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.15), transparent);
  z-index: 1;
}

#operationalSheetsSection .main-table tbody td.vm-section-highlight:not(.sticky-col) {
  position: relative;
  z-index: 1;
}

body.dark #operationalSheetsSection .main-table thead th.sticky-col {
  background: #1d2a44;
  background-clip: padding-box;
}

body.dark #operationalSheetsSection .main-table th.sticky-col,
body.dark #operationalSheetsSection .main-table td.sticky-col {
  background: var(--panel);
  background-clip: padding-box;
}

body.dark #operationalSheetsSection .main-table tbody tr:nth-child(even) td.sticky-col {
  background: color-mix(in srgb, var(--panel) 90%, #000);
  background-clip: padding-box;
}

body.dark #operationalSheetsSection .main-table tbody tr:hover td.sticky-col {
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
  background-clip: padding-box;
}

body.dark #operationalSheetsSection .main-table th.sticky-col-edge::after,
body.dark #operationalSheetsSection .main-table td.sticky-col-edge::after {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.38), transparent);
}

#operationalSheetsSection .main-table tr.operational-subtotal-row td {
  background: #fff6bf;
  background-clip: padding-box;
  color: #3f3a1d;
  font-weight: 800;
  box-shadow: inset 0 1px 0 #f1d56b, inset 0 -1px 0 #f1d56b;
}

#operationalSheetsSection .main-table tr.operational-subtotal-row td.operational-subtotal-cell strong {
  font-weight: 900;
}

#operationalSheetsSection .main-table tr.operational-subtotal-row td.sticky-col {
  background: #fff6bf;
  background-clip: padding-box;
}

body.dark #operationalSheetsSection .main-table tr.operational-subtotal-row td,
body.dark #operationalSheetsSection .main-table tr.operational-subtotal-row td.sticky-col {
  background: #3a3418;
  background-clip: padding-box;
  color: #f8e9a8;
  box-shadow: inset 0 1px 0 #5c4f1d, inset 0 -1px 0 #5c4f1d;
}

#operationalSheetsSection .main-table th.vm-section-highlight {
  background: var(--vm-section-th-bg);
  color: var(--vm-section-th-text);
  box-shadow: inset 0 -1px 0 var(--vm-section-th-border);
}

#operationalSheetsSection .main-table td.vm-section-highlight {
  background: var(--vm-section-td-bg);
  color: var(--text);
}

#operationalSheetsSection .main-table tbody tr:nth-child(even) td.vm-section-highlight {
  background: var(--vm-section-td-even-bg);
}

#operationalSheetsSection .main-table tbody tr:hover td.vm-section-highlight {
  background: var(--vm-section-td-hover-bg);
}

#operationalSheetsSection .main-table th.vm-section-highlight-start,
#operationalSheetsSection .main-table td.vm-section-highlight-start {
  border-left: 3px solid var(--vm-section-edge);
}

#operationalSheetsSection .main-table th.vm-section-highlight-end,
#operationalSheetsSection .main-table td.vm-section-highlight-end {
  border-right: 3px solid var(--vm-section-edge);
}

body.dark td,
body.dark .main-table td {
  background: var(--panel);
  color: var(--text);
}

body.dark tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--panel-soft) 88%, var(--panel));
}

body.dark tbody tr:hover td {
  background: color-mix(in srgb, var(--primary) 10%, var(--panel));
}

body.dark #operationalSheetsSection .main-table th.vm-section-highlight .column-filter-toggle {
  border-color: color-mix(in srgb, var(--vm-section-th-text) 28%, transparent);
  background: color-mix(in srgb, var(--panel) 35%, transparent);
  color: var(--vm-section-th-text);
}

body.dark #operationalSheetsSection .main-table th[data-key] .column-filter-toggle,
body.dark th .column-filter-toggle {
  border-color: rgba(248, 250, 252, 0.22);
  background: rgba(15, 23, 42, 0.45);
  color: #f8fafc;
}

body.dark .column-resize-handle::after {
  background: rgba(248, 250, 252, 0.16);
}

body.dark .cell-negative {
  color: #fca5a5;
  background: rgba(217, 45, 32, 0.14);
}

body.dark .remarks-input,
body.dark .pqt-input,
body.dark .summary-select {
  background: color-mix(in srgb, var(--panel-soft) 92%, #000);
  border-color: var(--line);
  color: var(--text);
}

body.dark #operationalSheetsSection .main-table td.vm-section-highlight .remarks-input,
body.dark #operationalSheetsSection .main-table td.vm-section-highlight .pqt-input {
  background: color-mix(in srgb, var(--panel) 90%, #000);
  border-color: color-mix(in srgb, var(--vm-section-edge) 32%, var(--line));
}

body.dark .vm-photo-empty,
body.dark .vm-photo-add {
  background: color-mix(in srgb, var(--primary) 14%, var(--panel));
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  color: color-mix(in srgb, var(--primary) 75%, #fff);
}

body.dark .vm-photo-item .vm-photo-tool-view {
  color: color-mix(in srgb, var(--primary) 70%, #fff);
}

body.dark .drop-zone {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  background: linear-gradient(180deg, rgba(36, 87, 214, 0.1), transparent);
}

body.dark .drop-icon {
  background: color-mix(in srgb, var(--primary) 18%, var(--panel));
}

body.dark .column-filter-menu {
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
}

.cell-status {
  border-radius: 999px;
  padding: 5px 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.status-done { background: var(--green); }
.status-critical { background: var(--red); }
.status-pending { background: var(--yellow); color: #3d2b00; }
.status-purchase { background: var(--blue); }
.status-normal { background: var(--gray); }

.summary-select-cell {
  padding: 4px 6px;
}

.summary-select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 800;
}

.summary-select.summary-select-locked,
.summary-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--panel) 82%, var(--muted));
  color: var(--muted);
}

.summary-select-cell-locked {
  background: color-mix(in srgb, var(--panel) 94%, var(--muted));
}

.trf-timestamp-cell {
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}

#addedDateFrom,
#addedDateTo {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
}

.pqt-input-cell {
  padding: 4px 6px;
  min-width: 0;
}

.pqt-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.pqt-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.15);
}

.pqt-input::placeholder {
  color: var(--muted);
}

.remarks-input-cell {
  padding: 4px 6px;
  min-width: 0;
}

.remarks-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
}

.remarks-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.15);
}

.photo-cell {
  padding: 6px 8px;
  min-width: 0;
  vertical-align: middle;
}

/* VM table photo column — multi-photo gallery */
.vm-photo-cell {
  padding: 4px 6px;
  min-width: 120px;
  max-width: 240px;
  vertical-align: middle;
}

.vm-photo-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.vm-photo-box.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.vm-photo-box.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  animation: vm-photo-pulse 1s ease-in-out infinite;
}

@keyframes vm-photo-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

.vm-photo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.vm-photo-pick-label {
  position: relative;
  cursor: pointer;
  margin: 0;
}

.vm-photo-pick-label input.vm-photo-file {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  clip: auto;
}

.vm-photo-video {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #111827;
}

.vm-photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 6px 4px;
  border: 1px dashed color-mix(in srgb, var(--primary) 35%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 4%, var(--panel));
  color: var(--primary);
  cursor: pointer;
  font: inherit;
}

.vm-photo-empty:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--panel));
}

.vm-photo-empty-icon {
  font-size: 16px;
  line-height: 1;
}

.vm-photo-empty-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.vm-photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.vm-photo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  flex: 0 0 auto;
}

.vm-photo-frame {
  position: relative;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-soft);
}

.vm-photo-frame .vm-photo-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-decoration: none;
}

.vm-photo-frame .vm-photo-thumb-link:hover {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

.vm-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 88%, #000);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
}

.vm-photo-remove:hover {
  filter: brightness(1.08);
}

.vm-photo-add {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 52px;
  height: 52px;
  padding: 4px 6px;
  border: 1px dashed color-mix(in srgb, var(--primary) 35%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 4%, var(--panel));
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  flex: 0 0 auto;
}

.vm-photo-add:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--panel));
}

.vm-photo-add-compact .vm-photo-empty-icon {
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.vm-photo-add-label {
  font-size: 9px;
  font-weight: 700;
}

.photo-capture-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 14px;
}

.photo-capture-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.76);
}

.photo-capture-dialog {
  position: relative;
  width: min(92vw, 520px);
  max-height: calc(100vh - 24px);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, #000);
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.photo-capture-head {
  display: grid;
  gap: 2px;
}

.photo-capture-note {
  font-size: 12px;
  color: var(--muted);
}

.photo-capture-video {
  width: 100%;
  max-height: min(62vh, 520px);
  border-radius: 10px;
  background: #000;
  object-fit: cover;
}

.photo-capture-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.vm-photo-filled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.vm-photo-thumb-link {
  display: block;
  width: 56px;
  height: 56px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  background: var(--panel-soft);
}

.vm-photo-thumb-link:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.vm-photo-thumb-btn {
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel-soft);
}

.vm-photo-thumb-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.vm-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--panel-soft);
}

.vm-photo-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
}

.vm-photo-tool {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  padding: 2px 5px;
  cursor: pointer;
}

.vm-photo-tool-view {
  color: var(--primary);
  border: none;
  background: transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.vm-photo-item .vm-photo-tool-view:hover {
  text-decoration: underline;
}

.vm-photo-tool-change {
  color: var(--text-soft);
}

.vm-photo-tool-del {
  min-width: 22px;
  padding: 2px 4px;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  font-size: 12px;
  line-height: 1;
}

.vm-photo-tool:hover {
  filter: brightness(0.97);
}

body.dark .vm-photo-empty {
  background: color-mix(in srgb, var(--primary) 8%, var(--panel));
}

body.dark .vm-photo-box.is-busy::after {
  background: rgba(15, 23, 42, 0.45);
}

.photo-cell-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.photo-cell-wrap-multi {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.photo-cell-wrap-multi.has-photos {
  align-items: flex-start;
}

.photo-thumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  max-width: 240px;
  min-width: 0;
}

.photo-thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.photo-preview {
  position: relative;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 10px;
  background: linear-gradient(145deg, var(--panel-soft), color-mix(in srgb, var(--primary) 6%, var(--panel)));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.photo-preview-btn {
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
}

.photo-preview-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb-error {
  object-fit: contain;
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}

.photo-cell.is-uploading {
  opacity: 0.85;
}

.photo-cell.is-uploading .photo-dropzone-title::after,
.photo-cell.is-uploading .photo-upload-btn-add span:last-child::after {
  content: "…";
}

.photo-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.photo-preview:hover .photo-thumb-overlay,
.photo-preview:focus-within .photo-thumb-overlay,
.photo-preview-btn:hover .photo-thumb-overlay,
.photo-preview-btn:focus-visible .photo-thumb-overlay {
  opacity: 1;
}

.photo-view-link {
  margin-top: 2px;
  width: 100%;
  min-width: 52px;
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  background: color-mix(in srgb, var(--primary) 8%, var(--panel));
  color: var(--primary);
  text-decoration: underline;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 6px;
}

.photo-view-link:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--panel));
  border-color: var(--primary);
}

.photo-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 88px;
  min-height: 72px;
  padding: 8px 10px;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 38%, var(--line));
  border-radius: 12px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 7%, var(--panel)), var(--panel-soft));
  color: var(--primary);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-dropzone:hover {
  border-color: var(--primary);
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 12%, var(--panel)), var(--panel-soft));
  box-shadow: 0 4px 14px rgba(36, 87, 214, 0.12);
  transform: translateY(-1px);
}

.photo-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.photo-dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--panel));
  color: var(--primary);
}

.photo-dropzone-icon svg {
  width: 16px;
  height: 16px;
}

.photo-dropzone-title {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.photo-dropzone-hint {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
}

.photo-upload-btn,
.photo-view-btn,
.photo-remove-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 9px;
  font-weight: 800;
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.photo-upload-btn-add {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, var(--panel)), var(--panel-soft));
  color: var(--primary);
  padding: 5px 10px;
  font-size: 10px;
}

.photo-upload-btn-add:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--panel)), var(--panel-soft));
}

.photo-upload-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
}

.photo-upload-icon svg {
  width: 14px;
  height: 14px;
}

.photo-remove-btn {
  min-width: 0;
  padding: 2px 6px;
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
  background: color-mix(in srgb, var(--red) 8%, var(--panel));
  color: var(--red);
  font-size: 8px;
}

.photo-remove-btn:hover {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
}

.photo-upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}

.photo-upload-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

body.dark .photo-preview {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

body.dark .photo-dropzone {
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 14%, var(--panel)), var(--panel-soft));
}

body.dark .photo-dropzone:hover {
  box-shadow: 0 4px 16px rgba(36, 87, 214, 0.22);
}

.photo-view-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.photo-viewer-open {
  overflow: hidden;
}

.photo-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 8px;
}

.photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
}

.photo-viewer-dialog {
  position: relative;
  z-index: 1;
  max-width: 98vw;
  max-height: 96vh;
  border-radius: 12px;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 10px 10px 8px;
}

.photo-viewer-image {
  display: block;
  max-width: 96vw;
  max-height: calc(96vh - 18px);
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  background: #111827;
}

.photo-viewer-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(2, 6, 23, 0.8);
  color: #e2e8f0;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.summary-status-cell {
  padding: 4px 6px;
  min-width: 168px;
}

#operationalSheetsSection .summary-status-cell {
  min-width: 168px;
}

.summary-status {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(217, 45, 32, 0.16);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.summary-status-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  display: block;
  background: var(--green);
  transition: width 0.25s ease;
}

.summary-status-active {
  background: rgba(245, 158, 11, 0.18);
}

.summary-status-active .summary-status-fill {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
}

.summary-status-done {
  color: #fff;
  background: rgba(22, 163, 74, 0.18);
}

.summary-status-done .summary-status-fill {
  background: var(--green);
}

.summary-status-none {
  background: rgba(217, 45, 32, 0.16);
}

.summary-status-none .summary-status-fill {
  width: 0 !important;
  background: var(--red);
}

.summary-status-none .summary-status-text {
  color: #fff;
}

.summary-status-text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.cell-negative {
  color: var(--red);
  font-weight: 700;
  background: rgba(217, 45, 32, 0.05);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.36);
  color: #fff;
  font-weight: 900;
}

.loader.active {
  display: grid;
}

.loader div {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.user-mgmt-card {
  margin-top: 0;
}

.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
}

.admin-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 30, 0.68);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.admin-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(1100px, 100vw);
  height: 100dvh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.28);
  transform: translateX(100%);
  transition: transform 0.26s ease;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-overlay.open .admin-overlay-backdrop {
  opacity: 1;
}

.admin-overlay.open .admin-drawer {
  transform: translateX(0);
}

.admin-overlay.workspace-mode .admin-overlay-backdrop {
  background: rgba(6, 11, 24, 0.96);
}

.admin-overlay.workspace-mode .admin-drawer {
  left: 0;
  right: 0;
  width: 100vw;
  border-left: none;
  box-shadow: none;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.admin-overlay.workspace-mode.open .admin-drawer {
  transform: translateY(0);
  opacity: 1;
}

.admin-drawer-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.admin-drawer-body {
  overflow: auto;
  padding: 16px;
}

body.overlay-open {
  overflow: hidden;
}

.overlay-panel-content {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
}

.workspace-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.user-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100dvh - 120px);
}

.user-workspace-sidebar {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 14px;
  display: grid;
  gap: 8px;
  align-content: start;
  position: sticky;
  top: 0;
  height: fit-content;
}

.user-workspace-sidebar h3 {
  margin: 0 0 6px 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-nav-btn {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.user-nav-btn.active {
  border-color: rgba(62, 140, 255, 0.35);
  background: rgba(62, 140, 255, 0.14);
  color: var(--blue);
}

.user-workspace-main {
  display: grid;
  gap: 12px;
  align-content: start;
}

.user-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.user-metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 12px;
}

.user-metric-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
}

.user-metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-workspace-note {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 14px;
  min-height: 120px;
}

.user-mgmt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.user-mgmt-toolbar input,
.user-mgmt-toolbar select {
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
}

.user-mgmt-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding-bottom: 8px;
}

.user-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.user-table th,
.user-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.user-table th {
  background: var(--panel-soft);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-actions .sm {
  padding: 6px 10px;
  font-size: 12px;
}

.user-table-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-role-user { background: rgba(47, 128, 237, 0.12); color: var(--blue); }
.badge-role-admin { background: rgba(249, 115, 22, 0.14); color: #c2410c; }
.badge-role-master { background: rgba(168, 85, 247, 0.14); color: #7e22ce; }
.badge-status.badge-active { background: rgba(24, 160, 88, 0.12); color: var(--green); }
.badge-status.badge-inactive { background: rgba(102, 112, 133, 0.15); color: var(--muted); }
.badge-status.badge-live { background: rgba(24, 160, 88, 0.12); color: var(--green); }
.badge-status.badge-offline { background: rgba(102, 112, 133, 0.15); color: var(--muted); }

.user-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(480px, 92vw);
  box-shadow: var(--shadow);
  background: var(--panel);
  color: var(--text);
}

.user-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.user-modal-head,
.user-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.user-modal-foot {
  border-bottom: none;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.user-modal-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.user-form-error {
  color: var(--red);
  font-size: 13px;
  margin: 0;
}

.user-submission-access {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 10px;
}

.user-submission-access legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-submission-access-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.user-submission-access-grid {
  display: grid;
  gap: 8px;
}

.user-module-access-subgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 520px) {
  .user-module-access-subgrid {
    grid-template-columns: 1fr;
  }
}

.user-checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.user-checkbox-field input {
  width: 16px;
  height: 16px;
}

.system-engine-card {
  margin-top: 0;
}

.system-engine-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.system-engine-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.system-engine-block h3 {
  margin: 0;
}

.system-engine-block p {
  color: var(--muted);
  font-size: 12px;
}

.system-engine-block input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--panel);
  color: var(--text);
}

.system-engine-table {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--panel);
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
}

.system-engine-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.system-engine-row:last-child {
  margin-bottom: 0;
}

.system-engine-row input {
  margin: 0;
}

.system-engine-placeholder-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.system-engine-admin-controls {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.system-engine-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.system-engine-tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.system-engine-tab.active {
  background: rgba(62, 140, 255, 0.14);
  border-color: rgba(62, 140, 255, 0.35);
  color: var(--blue);
}

.system-engine-dynamic-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.engine-rule-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.engine-rule-card label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.engine-rule-card input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--panel);
  color: var(--text);
}

.engine-rule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.engine-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.system-engine-placeholder {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.feeder-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.feeder-filter-label {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.feeder-filter-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feeder-filter-label select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
}

.status-pill.server-online {
  background: rgba(24, 160, 88, 0.12);
  color: var(--green);
}

.status-pill.server-offline {
  background: rgba(217, 45, 32, 0.12);
  color: var(--red);
}

.history-item[data-batch-id] {
  cursor: pointer;
}

.history-item[data-batch-id]:hover {
  border-color: var(--primary);
}

@media (max-width: 1280px) {
  .overview-layout {
    grid-template-columns: 1fr 1fr;
  }

  .overview-insights-panel {
    grid-column: 1 / -1;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pivot-fields,
  .pivot-fields-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-meta,
  .topbar-menus {
    justify-content: flex-start;
  }

  .topbar, .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  #operationalSheetsSection .section-heading.compact {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "pagination"
      "actions";
  }

  #operationalSheetsSection .section-heading.compact .pagination-controls.top-controls,
  #operationalSheetsSection .section-heading.compact .resize-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
  }

  #operationalSheetsSection .section-heading.compact .pagination-controls.top-controls span {
    flex: 1 1 auto;
    min-width: 0;
  }

  #operationalSheetsSection .table-wrap,
  #operationalSheetsSection .table-wrapper {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  .analytics-grid, .upload-grid, .kpi-grid {
    grid-template-columns: 1fr;
  }

  .dash-heads {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-expand-grid,
  .dash-expand-grid.four-col {
    grid-template-columns: 1fr;
  }

  .dash-chart-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions, .session-actions {
    width: 100%;
  }

  .topbar-actions button, .session-actions button,
  .role-pill, .upload-time-pill {
    width: auto;
    max-width: 100%;
  }

  .app-content {
    padding: 14px;
  }

  .topbar {
    margin: -14px -14px 18px;
  }
}

@media (max-width: 1024px) {
  .dashboard-cards,
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters-row,
  .filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .pivot-fields,
  .pivot-fields-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar-actions,
  .session-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

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

  .top-buttons,
  .topbar-actions,
  .session-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .filters-row select,
  .filters-row input,
  .filter-grid select,
  .filter-grid input {
    width: 100%;
  }

  .filter-grid,
  .filters-row {
    grid-template-columns: 1fr;
  }

  .pivot-fields,
  .pivot-fields-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(46vh, 420px);
  }

  .table-card {
    min-height: 420px;
    height: calc(100dvh - 120px);
  }

  .table-wrap,
  .table-wrapper {
    height: calc(100% - 82px);
    max-height: none;
  }

  .topbar-actions,
  .session-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar-actions button,
  .session-actions button,
  .role-pill,
  .upload-time-pill {
    width: 100%;
  }

  .system-engine-grid,
  .system-engine-placeholder-grid,
  .system-engine-dynamic-grid {
    grid-template-columns: 1fr;
  }

  .admin-drawer {
    width: 100vw;
  }

  .user-workspace {
    grid-template-columns: 1fr;
  }

  .user-workspace-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .pivot-fields,
  .pivot-fields-container {
    grid-template-columns: 1fr;
  }
}

/* Mobile-first redesign: compact, touch-friendly, table-priority layout */
@media (max-width: 768px) {
  .app-content {
    padding: 10px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(14px);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }

  body.dark .app-bottom-nav {
    background: color-mix(in srgb, var(--panel) 88%, #000);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28);
  }

  main {
    gap: 10px;
  }

  .topbar {
    position: static;
    margin: 0 0 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    backdrop-filter: none;
  }

  .topbar > div {
    width: 100%;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .session-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-card {
    padding: 12px;
    border-radius: 14px;
  }

  #dataInputCard .upload-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #dashboardHubCard .dash-hub {
    border-radius: 12px;
  }

  #operationalSheetsSection .operational-sheet-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--panel);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }

  #operationalSheetsSection .operational-sheet-header-top {
    flex-direction: row;
    align-items: center;
  }

  #operationalSheetsSection .section-heading.compact {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "pagination"
      "actions";
  }

  #operationalSheetsSection .section-heading.compact .pagination-controls.top-controls,
  #operationalSheetsSection .section-heading.compact .resize-controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }

  #operationalSheetsSection .section-heading.compact .pagination-controls.top-controls span {
    flex: 1 1 auto;
    min-width: 0;
  }

  #operationalSheetsSection .pagination-controls.top-controls button,
  #operationalSheetsSection .resize-controls button {
    padding: 7px 10px;
    font-size: 12px;
  }

  #operationalSheetsSection .table-card,
  #operationalSheetsSection .table-card.table-size-full {
    min-height: calc(var(--operational-card-chrome) + var(--operational-head-height) + (var(--operational-visible-rows) * var(--operational-row-height)));
    max-height: none;
    height: auto !important;
  }

  #operationalSheetsSection .table-card.is-collapsed,
  #operationalSheetsSection .table-card.table-size-full.is-collapsed {
    flex: 0 0 auto;
    height: auto !important;
    min-height: 0;
    max-height: none;
  }

  #operationalSheetsSection .table-wrap,
  #operationalSheetsSection .table-wrapper,
  #operationalSheetsSection .table-card.table-size-full .table-wrap {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: contain;
    isolation: auto;
  }

  #operationalSheetsSection .operational-table-body {
    min-width: 0;
    max-width: 100%;
  }

  #operationalSheetsSection .main-table th.sticky-col,
  #operationalSheetsSection .main-table td.sticky-col {
    touch-action: pan-x pan-y;
  }

  #operationalSheetsSection .column-resize-handle {
    touch-action: pan-x pan-y;
    pointer-events: none;
  }

  .main-table,
  table {
    font-size: 10.5px;
  }

  .main-table th,
  .main-table td,
  th,
  td {
    padding: 5px 6px;
  }
}

@media (max-width: 480px) {
  .topbar {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    margin: 0 0 10px !important;
  }

  #operationalSheetsSection .operational-sheet-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .pagination-controls.top-controls button,
  .resize-controls button {
    flex: 1 1 auto;
  }
}
