/* ═══════════════════════════════════════════════════════
   GEMA RESPONSIVE — Global Mobile & Tablet Overrides
   Loaded AFTER inline <style> to override with specificity.
   Breakpoints: 768px (Tablet), 640px (Phone), 480px (Small)
   ═══════════════════════════════════════════════════════ */

/* ── 0. MOBILE HAMBURGER MENU ── */

/* Hamburger button (hidden on desktop by JS) */
.gema-hamburger {
  display: none; /* JS controls visibility */
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border2, #cdd4e4);
  background: var(--surface, #fff);
  color: var(--text2, #374151);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
  padding: 0;
  margin-left: auto;
}
.gema-hamburger:hover {
  background: var(--bg2, #edf0f7);
}
.gema-hamburger.active {
  background: var(--accent-bg, #eff4ff);
  border-color: var(--accent-bd, #bfcfff);
  color: var(--accent, #2563eb);
}

/* Overlay (blurred backdrop) */
.gema-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  pointer-events: none;
  transition: background .3s ease, backdrop-filter .3s ease, -webkit-backdrop-filter .3s ease;
}
.gema-menu-overlay.open {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

/* Slide-in panel from right */
.gema-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  width: 280px;
  max-width: 85vw;
  background: var(--surface, #fff);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.gema-menu-panel.open {
  transform: translateX(0);
}

/* Panel header */
.gema-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1.5px solid var(--border, #e2e7f0);
  flex-shrink: 0;
}
.gema-menu-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text, #111827);
  letter-spacing: -0.3px;
}
.gema-menu-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border2, #cdd4e4);
  background: var(--surface, #fff);
  color: var(--muted, #6b7280);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .15s;
  padding: 0;
}
.gema-menu-close:hover {
  background: var(--bg2, #edf0f7);
  color: var(--text, #111827);
}

/* Menu item list */
.gema-menu-list {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Menu item */
.gema-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text2, #374151);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.gema-menu-item:hover {
  background: var(--bg2, #edf0f7);
}
.gema-menu-item:active {
  background: var(--border, #e2e7f0);
  transform: scale(0.98);
}

.gema-menu-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg2, #edf0f7);
  flex-shrink: 0;
}

.gema-menu-label {
  flex: 1;
}

/* Feedback item special */
.gema-menu-item--feedback {
  color: #dc2626;
}
.gema-menu-item--feedback .gema-menu-icon {
  background: #fef2f2;
}

/* Logout item special */
.gema-menu-item--logout {
  color: var(--muted, #6b7280);
  margin-top: 4px;
  border-top: 1px solid var(--border, #e2e7f0);
  border-radius: 0 0 12px 12px;
  padding-top: 16px;
}

/* Footer */
.gema-menu-footer {
  padding: 16px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2, #9ca3af);
  text-align: center;
  border-top: 1px solid var(--border, #e2e7f0);
  flex-shrink: 0;
}

/* Safe area for iPhone bottom */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .gema-menu-panel {
    padding-bottom: env(safe-area-inset-bottom);
  }
}


/* ── 1. PREVENT HORIZONTAL SCROLL (Global) ── */
html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-x: clip;
  position: relative;
  width: 100%;
}
body.modal-open {
  overflow: hidden !important;
}

/* Nav immer sichtbar (sticky + fixed Fallback) */
.g-nav {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 200;
}

/* Safe area support (iPhone notch / Dynamic Island) */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ── 2. TABLET (max-width: 768px) ── */
@media (max-width: 768px) {

  /* Nav */
  .g-nav-inner {
    padding: 0 16px;
    height: 48px;
    gap: 8px;
  }
  .g-nav-logo {
    margin-right: 8px;
  }
  .g-nav-mark svg,
  .g-nav-mark img {
    height: 24px;
  }
  .g-nav-bc a,
  .g-nav-bc span {
    font-size: 11.5px;
    padding: 3px 5px;
  }
  .g-nav-btn,
  .nav-pill {
    padding: 5px 10px;
    font-size: 11px;
  }
  .nav-tagline {
    display: none;
  }

  /* Page wrapper */
  .g-page {
    padding: 16px 14px 48px;
  }

  /* Page header */
  .g-ph {
    padding: 16px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  /* Hero sections */
  .hero {
    padding: 40px 18px 48px;
  }
  .hero-inner {
    flex-direction: column;
    gap: 24px;
  }
  .hero-text {
    min-width: 0;
    width: 100%;
  }
  .hero h1 {
    font-size: clamp(26px, 6vw, 36px);
    letter-spacing: -0.8px;
  }
  .hero p {
    font-size: 15px;
    max-width: 100%;
  }
  .hero-badges {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .hero-badge {
    min-width: 0;
    flex: 1;
    min-width: 160px;
    padding: 10px 14px;
  }
  .hero-stats {
    gap: 20px;
  }

  /* Grids */
  .mod-grid,
  .g-grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 12px;
  }
  .g-grid-2, .g-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Filter bar */
  .filter-bar {
    padding: 0 14px;
  }
  .filter-inner {
    height: 46px;
    gap: 2px;
  }
  .filter-btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }

  /* Main container (index.html etc.) */
  .main {
    padding: 24px 16px 60px;
  }

  /* Category headers */
  .cat-header {
    gap: 10px;
    margin-bottom: 14px;
  }
  .cat-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 18px;
  }
  .cat-title-text {
    font-size: 17px;
  }

  /* Cards */
  .g-card,
  .card {
    border-radius: 14px;
  }

  /* Tables: scrollable wrapper */
  .g-table-wrap,
  .tbl-scroll,
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  /* KPI grids */
  .g-kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 8px;
  }

  /* Result cards */
  .g-result-list {
    gap: 8px;
  }

  /* Sections */
  .g-section,
  section {
    scroll-margin-top: 100px;
  }

  /* Modals */
  .modal-bg {
    padding: 16px 12px;
  }
  .modal,
  .modal-box {
    max-width: calc(100vw - 24px) !important;
    border-radius: 16px;
  }
  .modal-hd,
  .modal-header {
    padding: 16px 18px;
  }
  .modal-body {
    padding: 16px 18px;
  }
  .modal-ft,
  .modal-footer {
    padding: 14px 18px;
  }

  /* Combo widget (Projekt-Feld) */
  .obj-combo {
    flex-wrap: wrap;
  }

  /* Search — die fixe 160px-Breite war ein Relikt aus der Zeit, als
     die Suche ein kleines Feld in der Filter-Bar war. Mit der neuen
     full-width search-bar auf index.html zerstoerte sie das Layout
     (Lupe ragte aus dem Container). Nicht mehr setzen. */
}


/* ── 3. PHONE (max-width: 640px) ── */
@media (max-width: 640px) {

  /* Nav collapses further */
  .g-nav-inner {
    padding: 0 12px;
    height: 46px;
    gap: 6px;
  }
  .g-nav-logo {
    margin-right: 6px;
  }
  .g-nav-mark svg,
  .g-nav-mark img {
    height: 22px;
  }
  /* Hide breadcrumb text, keep current page */
  .g-nav-bc a:not(.bc-cur),
  .g-nav-bc .bc-sep {
    display: none;
  }
  .g-nav-bc .bc-cur {
    font-size: 12px;
    padding: 2px 4px;
  }
  /* Nav-right is hidden by hamburger JS on mobile — no overrides needed */

  /* Page wrapper */
  .g-page {
    padding: 12px 10px 40px;
  }

  /* Hero */
  .hero {
    padding: 28px 14px 36px;
    border-radius: 0;
  }
  .hero h1 {
    font-size: clamp(22px, 7vw, 30px);
    letter-spacing: -0.5px;
  }
  .hero p {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 20px;
  }
  .hero-eyebrow {
    font-size: 10.5px;
    padding: 4px 10px;
    margin-bottom: 14px;
  }
  .hero-stats {
    gap: 16px;
  }
  .hero-stat-num {
    font-size: 22px;
  }
  .hero-stat-lbl {
    font-size: 11px;
  }
  .hero-badges {
    flex-direction: column;
  }
  .hero-badge {
    min-width: 0;
    flex: unset;
    width: 100%;
  }

  /* Grids → single column */
  .mod-grid,
  .g-grid-auto {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .g-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }

  /* Stats row */
  .stats-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }

  /* Filter bar */
  .filter-bar {
    padding: 0 10px;
    top: 46px;
  }
  .filter-inner {
    height: 42px;
  }
  .filter-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
  .filter-sep {
    height: 18px;
    margin: 0 3px;
  }

  /* Main content */
  .main {
    padding: 16px 12px 60px;
  }

  /* Category sections */
  .cat-section {
    margin-bottom: 32px;
  }
  .cat-icon-wrap {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .cat-title-text {
    font-size: 15px;
  }

  /* Module cards */
  .mod-card-top {
    padding: 14px 14px 10px;
  }
  .mod-icon-box {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  .mod-body {
    padding: 0 14px 12px;
  }
  .mod-title {
    font-size: 14px;
  }
  .mod-desc {
    font-size: 12px;
  }
  .mod-footer {
    padding: 10px 14px;
  }
  .mod-norm {
    font-size: 9.5px;
    padding: 2px 5px;
  }

  /* Page header */
  .g-ph {
    padding: 14px 14px;
    border-radius: 14px;
    gap: 10px;
  }
  .g-ph-left {
    gap: 10px;
  }

  /* Cards */
  .g-card,
  .card {
    border-radius: 12px;
  }
  .card-hd,
  .card-header {
    padding: 14px 14px;
  }
  .card-body {
    padding: 14px;
  }

  /* Forms: inputs, selects, textareas */
  .g-page input[type="text"],
  .g-page input[type="email"],
  .g-page input[type="password"],
  .g-page input[type="tel"],
  .g-page input[type="url"],
  .g-page select,
  .g-page textarea {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
  }

  /* Tables: ensure horizontal scroll */
  table {
    font-size: 12px;
  }
  th, td {
    padding: 8px 10px;
  }

  /* Sections with tabs */
  .tab-bar,
  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar,
  .tabs-bar::-webkit-scrollbar {
    display: none;
  }

  /* Buttons general */
  .btn, .g-btn {
    padding: 8px 14px;
    font-size: 12.5px;
  }

  /* Modals: full-width on phone */
  .modal-bg {
    padding: 10px 8px;
    align-items: flex-start;
  }
  .modal,
  .modal-box {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 14px;
    max-height: 88vh;
  }
  .modal-hd,
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 14px 16px;
  }
  .modal-ft,
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Combo widget */
  .obj-combo-toggle {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  /* Search — position:relative MUSS bleiben, damit das absolut
     positionierte .search-icon innerhalb des Wrappers verankert
     bleibt (sonst wandert die Lupe zum naechsten positionierten
     Vorfahren, typisch <body>, und sitzt "irgendwo unten").
     Frueher war hier 'position: static' — das zerstoerte das
     Lupen-Layout auf Phone. */
  .search-wrap {
    width: 100%;
    margin: 0;
  }
  .search-inp {
    width: 100%;
  }
}


/* ── 4. SMALL PHONE (max-width: 380px) ── */
@media (max-width: 380px) {

  .g-page {
    padding: 10px 8px 36px;
  }

  .hero {
    padding: 22px 10px 28px;
  }
  .hero h1 {
    font-size: 22px;
  }

  .g-kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .stats-row {
    grid-template-columns: 1fr !important;
  }

  .g-nav-inner {
    padding: 0 8px;
  }
}


/* ── 5. TABLET LANDSCAPE (max-width: 1024px) ── */
@media (max-width: 1024px) {

  /* Hero layout for iPad */
  .hero-inner {
    gap: 28px;
  }
  .hero-badges {
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* Grids: allow 2 columns */
  .g-grid-3 {
    grid-template-columns: 1fr 1fr !important;
  }
}


/* ── 6. PROJECT BAR & GRIDS (used across 20+ calculation modules) ── */
@media (max-width: 768px) {
  .project-bar {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
  .grid2 {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .grid3 {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
}
@media (max-width: 640px) {
  .project-bar,
  .grid2,
  .grid3 {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
}


/* ── 7. TABLES — min-width override for mobile ── */
@media (max-width: 768px) {
  .tbl,
  .app-table,
  .tool-table,
  .anlage-table,
  .vote-table,
  .maengel-table,
  .check-table {
    min-width: 0 !important;
  }
  /* Ensure all table wrappers scroll */
  .tbl-wrap,
  .table-wrap,
  .tbl-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 640px) {
  /* Override inline min-width on table headers */
  .tbl th, .tbl td,
  .app-table th, .app-table td,
  .tool-table th, .tool-table td,
  .g-table th, .g-table td {
    padding: 6px 8px !important;
    font-size: 11.5px;
    min-width: 0 !important;
  }
  .vote-table {
    font-size: 11px;
  }
  .vote-table th.opt-head {
    min-width: 60px !important;
  }
}


/* ── 8. ACTION BARS (fixed bottom bars) ── */
@media (max-width: 640px) {
  .act-bar {
    padding: 8px 10px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
  }
  .act-bar-in {
    flex-wrap: wrap;
    gap: 6px;
  }
  .footer-bar {
    padding: 8px 10px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
  }
  .footer-bar .footer-inner,
  .footer-bar > div {
    flex-wrap: wrap;
    gap: 6px;
  }
}


/* ── 9. TOASTS ── */
@media (max-width: 640px) {
  #toast,
  .toast {
    left: 12px !important;
    right: 12px !important;
    bottom: 16px !important;
    transform: none !important;
    max-width: none !important;
    text-align: center;
    font-size: 13px;
  }
}


/* ── 10. CALCULATION MODULE SPECIFICS ── */
@media (max-width: 768px) {
  /* Card headers */
  .g-card-hd {
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  .g-card-bd {
    padding: 14px;
  }

  /* Section blocks */
  .g-section-hd {
    padding: 10px 14px;
    gap: 8px;
  }
  .g-section-bd {
    padding: 14px;
  }
  .g-section-title {
    font-size: 12.5px;
  }

  /* Tabs */
  .g-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .g-tabs::-webkit-scrollbar {
    display: none;
  }
  .g-tab {
    flex: 0 0 auto;
    padding: 7px 10px;
    font-size: 11.5px;
  }

  /* Result rows */
  .g-result-row {
    flex-wrap: wrap;
    gap: 4px 12px;
  }
  .g-result-lbl {
    flex-basis: 100%;
    font-size: 12px;
  }

  /* KPI values */
  .g-kpi-val {
    font-size: 18px;
  }

  /* Input groups */
  .g-inp-group {
    flex-wrap: nowrap;
    max-width: 100%;
  }
  .g-inp-unit {
    font-size: 11px;
    padding: 8px 8px;
  }

  /* Druckdispositiv table */
  .dp-table td.input-cell input {
    min-width: 60px;
  }
}

@media (max-width: 640px) {
  .g-card-hd h2 {
    font-size: 12.5px;
  }
  .g-section-num {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
}


/* ── 11. ALTERNATE NAV PATTERN (g-nav as direct flex, no g-nav-inner) ── */
@media (max-width: 768px) {
  .g-nav {
    padding: 0 16px;
    gap: 8px;
  }
}
@media (max-width: 640px) {
  .g-nav {
    padding: 0 12px;
    height: 46px;
    gap: 6px;
  }
  .g-nav-bc {
    font-size: 11.5px;
  }
}

/* ── 12. PAGE CLASS (sys_profil, sys_admin etc.) ── */
@media (max-width: 768px) {
  .page {
    padding: 20px 14px;
  }
  .page-title {
    font-size: 20px;
  }
}
@media (max-width: 640px) {
  .page {
    padding: 16px 10px;
  }
  .page-title {
    font-size: 18px;
  }
  .page-sub {
    font-size: 12px;
  }
}

/* ── 13. TABS (sys_admin, hy_w12 etc.) ── */
@media (max-width: 640px) {
  .tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    padding: 7px 14px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ── 14. USER LIST (sys_admin) ── */
@media (max-width: 640px) {
  .user-item {
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }
  .user-item .btn,
  .user-item .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
  }
}


/* ── 15. DROPDOWNS & POPOVERS ── */
@media (max-width: 640px) {
  #objQuickDrop {
    min-width: 280px !important;
    max-width: calc(100vw - 24px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
}

/* ── 16. DYNAMIC TABLES (JS-generated with inline min-width) ── */
@media (max-width: 768px) {
  .dt th,
  .dt td {
    min-width: 0 !important;
    padding: 6px 8px;
  }
  .dt {
    font-size: 11px !important;
  }
}


/* ── 17. W12 SIDEBAR LAYOUT (hy_w12) ── */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 52px);
    overflow: visible;
  }
  .sb {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1.5px solid var(--border, #e2e7f0);
    max-height: 50vh;
    overflow-y: auto;
  }
  .sb.collapsed {
    max-height: 0;
    border-bottom: none;
    overflow: hidden;
  }
  .sb-inner {
    width: 100% !important;
    padding: 10px 14px;
  }
  .main {
    overflow: visible;
    min-height: 0;
  }
  .topbar {
    padding: 8px 14px;
    flex-wrap: wrap;
  }
  .tabs {
    padding: 6px 14px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    flex-shrink: 0;
    padding: 7px 12px;
    font-size: 11.5px;
  }
  .content {
    padding: 14px !important;
    overflow: visible !important;
  }
}

@media (max-width: 640px) {
  .topbar-title {
    font-size: 12.5px;
  }
  .topbar-badge {
    font-size: 10px;
    padding: 2px 7px;
  }
}

/* ── 18. INSPECTION / TOOL TABLES (hy_inspektion, if_werkzeug) ── */
@media (max-width: 768px) {
  .anlage-table,
  .tool-table {
    min-width: 0 !important;
    font-size: 12px;
  }
}
@media (max-width: 640px) {
  .toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
  }
  .toolbar .btn,
  .toolbar .g-nav-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
}


/* ── 19. FIELD ROW GRIDS (used in modals/forms across many modules) ── */
@media (max-width: 640px) {
  .field-row.c2,
  .field-row.c3,
  .fg-row,
  .g2, .g3 {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
}

/* ── 20. CRBX / OFFERTVERGLEICH TABLES ── */
@media (max-width: 768px) {
  .lv-table,
  .ov-table {
    min-width: 0 !important;
    font-size: 11.5px;
  }
  .lv-table th,
  .lv-table td,
  .ov-table th,
  .ov-table td {
    padding: 6px 8px !important;
    min-width: 0 !important;
  }
}

/* ── 21. BESPRECHUNG TABLES ── */
@media (max-width: 640px) {
  .prt-table th,
  .prt-table td {
    min-width: 0 !important;
    width: auto !important;
    padding: 6px 8px !important;
  }
}

/* ── 22. LIEFERANT-DASHBOARD ── */
@media (max-width: 768px) {
  .prod-editor {
    width: 100% !important;
    max-width: 100% !important;
    position: fixed;
    inset: 0;
    z-index: 400;
    border-radius: 0;
  }
}

/* ── 23. SPUELMANAGER TABS ── */
@media (max-width: 640px) {
  .tab-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
}

/* ── 24. QUIZ LAYOUT ── */
@media (max-width: 640px) {
  .qp-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .quiz-card {
    padding: 16px;
    border-radius: 14px;
  }
}

/* ── 25. FAHRZEUG / WERKZEUG TABLES ── */
@media (max-width: 768px) {
  .fz-table th,
  .fz-table td {
    min-width: 0 !important;
    width: auto !important;
    white-space: normal !important;
  }
}


/* ── 26. FORM ELEMENTS ── */
@media (max-width: 640px) {
  input, select, textarea {
    max-width: 100%;
  }
  .search-box {
    min-width: 0 !important;
    width: 100%;
  }
}


/* ── 11. LOGIN PAGE ── */
@media (max-width: 480px) {
  .login-card {
    border-radius: 14px;
  }
  .login-hd {
    padding: 24px 20px 22px;
  }
  .login-body {
    padding: 20px;
  }
}


/* ── 12. PRINT (unaffected by responsive) ── */
@media print {
  html, body {
    overflow: visible !important;
  }
}


/* ── 7. TOUCH IMPROVEMENTS ── */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets (Apple HIG recommends 44px) */
  .btn, .g-btn {
    min-height: 44px;
  }
  .filter-btn,
  .tab-btn {
    min-height: 36px;
  }

  /* Remove hover effects that feel wrong on touch */
  .mod-card:hover {
    transform: none;
  }
  .g-nav-btn:hover,
  .nav-pill:hover {
    transform: none;
  }

  /* Smooth scrolling for tab bars */
  .tab-bar,
  .tabs-bar,
  .filter-inner {
    scroll-snap-type: x mandatory;
  }
  .tab-bar > *,
  .tabs-bar > *,
  .filter-inner > * {
    scroll-snap-align: start;
  }
}
