:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #132033;
  --muted: #667085;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #166534;
  --success-soft: #ecfdf3;
  --warning: #92400e;
  --warning-soft: #fffbeb;
  --border: #d9e1ec;
  --shadow: 0 18px 45px rgba(15, 23, 42, .09);
  --shadow-soft: 0 10px 26px rgba(15, 23, 42, .07);
  --radius: 24px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15,118,110,.14), transparent 30rem),
    radial-gradient(circle at 92% 4%, rgba(37,99,235,.10), transparent 28rem),
    linear-gradient(180deg, #f8fbff, var(--bg));
  line-height: 1.45;
}
a { color: inherit; }
img, svg, video { max-width: 100%; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 9999; transform: translateY(-160%); background: white; padding: .7rem 1rem; border-radius: 999px; box-shadow: var(--shadow); }
.skip-link:focus { transform: translateY(0); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  color: white;
  background: linear-gradient(135deg, #101828, #115e59);
  box-shadow: 0 12px 32px rgba(15,23,42,.20);
  padding: .75rem max(1rem, env(safe-area-inset-left)) .8rem max(1rem, env(safe-area-inset-right));
}
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 900; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(135deg, #14b8a6, #2563eb); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.user-pill { display: grid; justify-items: end; font-weight: 800; }
.user-pill small { opacity: .78; font-weight: 700; }
.container { width: min(1180px, calc(100% - 2rem)); margin: 1.35rem auto 5.5rem; }
.card { background: rgba(255,255,255,.93); border: 1px solid rgba(217,225,236,.85); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: clamp(1rem, 2.5vw, 1.45rem); }
.narrow { max-width: 720px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; margin-bottom: 1rem; }
h1, h2, h3 { margin: 0 0 .45rem; line-height: 1.12; letter-spacing: -.03em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.65rem); }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .35rem; color: var(--primary); text-transform: uppercase; font-size: .78rem; font-weight: 950; letter-spacing: .12em; }
.hero-actions, .section-head, .page-head.with-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.page-head { margin: .3rem 0 1rem; }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border-radius: 14px; border: 1px solid var(--border); background: white; color: var(--text); padding: .7rem .95rem; text-decoration: none; font-weight: 900; cursor: pointer; box-shadow: 0 6px 14px rgba(15,23,42,.05); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #14b8a6); color: white; border-color: transparent; }
.btn.small { min-height: 34px; padding: .42rem .65rem; border-radius: 11px; font-size: .88rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin: 1rem 0; }
.stat span { display: block; color: var(--muted); font-weight: 700; }
.stat strong { display: block; font-size: 2rem; letter-spacing: -.04em; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.warehouse-grid, .admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.warehouse-card, .admin-tile { text-decoration: none; transition: transform .14s ease, box-shadow .14s ease; }
.warehouse-card:hover, .admin-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 900; font-size: .78rem; padding: .28rem .6rem; }
.form-grid { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; font-weight: 850; }
.field-help { color: var(--muted); font-size: .84rem; font-weight: 650; line-height: 1.35; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 14px; background: #fff; padding: .72rem .82rem; color: var(--text); font: inherit; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(20,184,166,.25); border-color: #14b8a6; }
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 680px; background: white; }
th, td { padding: .85rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #475467; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
.inline-correction { display: grid; grid-template-columns: 96px minmax(180px,1fr) auto; gap: .5rem; align-items: center; }
.warehouse-list, .movement-list { display: grid; gap: .65rem; }
.warehouse-item, .movement-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem; border-radius: 17px; text-decoration: none; background: #f8fafc; border: 1px solid var(--border); }
.warehouse-item small, .movement-row small { display: block; color: var(--muted); }
.flash { margin: 0 0 .8rem; padding: .85rem 1rem; border-radius: 16px; border: 1px solid var(--border); font-weight: 800; background: white; }
.flash.success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.flash.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.warning-card { border-color: #fed7aa; background: var(--warning-soft); }
.empty { color: var(--muted); font-weight: 800; }
.search-form { display: flex; gap: .5rem; min-width: min(100%, 420px); }
.search-form input { min-width: 0; }
.login-shell { min-height: calc(100dvh - 180px); display: grid; place-items: center; }
.login-card { width: min(100%, 470px); }
.file-hint { color: var(--primary-dark); font-weight: 800; }
@media (max-width: 900px) {
  .hero, .grid.two, .warehouse-grid, .admin-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .container { width: min(100% - 1rem, 1180px); margin-top: .85rem; }
  .user-pill { display: none; }
  .inline-correction { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero-actions, .page-head.with-actions, .section-head, .search-form { align-items: stretch; flex-direction: column; }
  .btn { width: 100%; }
  .brand span:last-child { max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media print {
  body { background: white; }
  .container { width: 100%; margin: 0; }
  .card { box-shadow: none; border: none; }
  table { min-width: 0; }
}

/* 2026 update: polished navigation, transfer lines and admin editing */
.brand span:last-child { display: grid; line-height: 1.05; }
.brand small { opacity: .78; font-size: .74rem; font-weight: 750; letter-spacing: 0; margin-top: .15rem; }
.top-actions { display: flex; align-items: center; gap: .75rem; }
.logout-pill { min-height: 40px; display: inline-flex; align-items: center; padding: .45rem .75rem; border-radius: 999px; text-decoration: none; font-weight: 900; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); }
.nav-link span { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 999px; background: rgba(255,255,255,.10); margin-right: .25rem; }
.nav-link.highlight { background: linear-gradient(135deg, rgba(20,184,166,.28), rgba(59,130,246,.22)); }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn.secondary { background: #eef6ff; border-color: #bfdbfe; color: #1d4ed8; }
.btn.danger { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.btn.ghost { box-shadow: none; }
.form-note { border: 1px solid #99f6e4; background: linear-gradient(135deg, #ecfeff, #f0fdfa); color: #134e4a; border-radius: 16px; padding: .75rem .9rem; font-weight: 800; }
.compact-grid { margin: 0; }
.transfer-form .primary { justify-self: start; min-width: min(100%, 280px); }
.transfer-lines { display: grid; gap: .55rem; }
.transfer-line { display: grid; grid-template-columns: minmax(220px, 1fr) 130px auto; gap: .55rem; align-items: center; padding: .55rem; border: 1px solid var(--border); border-radius: 18px; background: #f8fafc; }
.transfer-line-head { padding: 0 .55rem; border: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 950; text-transform: uppercase; letter-spacing: .04em; }
.transfer-line select, .transfer-line input { background: white; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.settings-card { margin-top: 1rem; }
.settings-form { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: .75rem; align-items: end; }
.admin-tile { position: relative; overflow: hidden; }
.tile-icon { position: absolute; right: 1rem; top: 1rem; font-size: 2rem; opacity: .16; }
.record-list { display: grid; gap: .75rem; }
.record-card { border: 1px solid var(--border); border-radius: 18px; background: #fff; padding: .85rem; }
.record-card.inactive { background: #f8fafc; opacity: .82; }
.record-summary { display: flex; justify-content: space-between; gap: .75rem; align-items: start; }
.record-summary small { display: block; color: var(--muted); margin-top: .12rem; }
.status-pill { border-radius: 999px; padding: .22rem .55rem; font-size: .78rem; font-weight: 950; }
.status-pill.ok { color: var(--success); background: var(--success-soft); }
.status-pill.off { color: var(--danger); background: var(--danger-soft); }
.edit-panel { margin-top: .65rem; }
.edit-panel summary { cursor: pointer; font-weight: 950; color: var(--primary-dark); padding: .55rem 0; }
.compact-form { margin: .5rem 0 .65rem; padding: .85rem; border-radius: 16px; background: #f8fafc; border: 1px solid var(--border); }
.check-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .55rem; font-weight: 900; }
.check-row input { width: 20px; min-height: 20px; }
.stock-print-card table { min-width: 620px; }
@media (max-width: 900px) {
  .top-actions .logout-pill { display: none; }
  .brand small { display: none; }
  .transfer-line, .transfer-line-head { grid-template-columns: 1fr; }
  .transfer-line-head { display: none; }
  .transfer-form .primary { width: 100%; }
  .settings-form { grid-template-columns: 1fr; }
  .actions-row { width: 100%; }
  .actions-row .btn { flex: 1 1 160px; }
}
@media print {
  .form-note, .actions-row, .print-head .btn { display: none !important; }
  .stock-print-card table { min-width: 0; }
}

/* 2026-05 top menu refresh: horizontal navigation with dropdowns */
.topbar {
  padding-block: .6rem;
}
.topbar-inner {
  max-width: 1320px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
}
.authenticated .container {
  width: min(1320px, calc(100% - 2rem));
  margin-top: 1.15rem;
  margin-bottom: 2.5rem;
}
.top-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-width: 0;
}
.nav-link,
.nav-summary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  padding: .43rem .67rem;
  border-radius: 999px;
  color: rgba(255,255,255,.88);
  text-decoration: none;
  font-weight: 900;
  line-height: 1;
  border: 1px solid transparent;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: none;
}
.nav-link:hover,
.nav-summary:hover,
.nav-link.active,
.nav-dropdown.active > .nav-summary,
.nav-dropdown[open] > .nav-summary {
  color: #fff;
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.22);
}
.nav-link.highlight {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: white;
  box-shadow: 0 12px 24px rgba(20,184,166,.22);
}
.nav-link.highlight:hover,
.nav-link.highlight.active {
  background: linear-gradient(135deg, #14b8a6, #2563eb);
}
.nav-link > span:not(.nav-icon),
.nav-summary > span:not(.nav-icon):not(.chevron) {
  display: inline;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  margin-right: 0;
  place-items: initial;
}
.nav-icon {
  width: 1.45rem;
  height: 1.45rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  margin-right: 0;
  font-size: .95rem;
}
.nav-dropdown {
  position: relative;
}
.nav-dropdown summary {
  list-style: none;
}
.nav-dropdown summary::-webkit-details-marker {
  display: none;
}
.chevron {
  opacity: .78;
  font-size: .9rem;
  transform: translateY(-1px);
}
.nav-dropdown[open] .chevron {
  transform: rotate(180deg) translateY(1px);
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + .65rem);
  left: 0;
  z-index: 60;
  width: min(330px, calc(100vw - 2rem));
  padding: .45rem;
  border-radius: 20px;
  border: 1px solid rgba(217,225,236,.92);
  background: rgba(255,255,255,.98);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(15,23,42,.22);
  backdrop-filter: blur(18px);
}
.dropdown-menu.admin-menu {
  width: min(370px, calc(100vw - 2rem));
}
.dropdown-link {
  display: grid;
  gap: .12rem;
  padding: .75rem .85rem;
  border-radius: 15px;
  text-decoration: none;
  border: 1px solid transparent;
}
.dropdown-link strong {
  font-size: .96rem;
}
.dropdown-link small {
  color: var(--muted);
  font-weight: 750;
}
.dropdown-link:hover,
.dropdown-link.active {
  background: linear-gradient(135deg, #ecfeff, #eff6ff);
  border-color: #bae6fd;
  color: var(--primary-dark);
}
.dropdown-link:hover small,
.dropdown-link.active small {
  color: #155e75;
}
.low-stock-alert {
  border-width: 2px;
  box-shadow: 0 18px 38px rgba(146,64,14,.13);
  margin-bottom: 1rem;
}
.low-stock-alert .eyebrow { color: var(--warning); }
.stats-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1180px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
  }
  .top-actions {
    justify-self: end;
  }
  .top-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-top: .15rem;
  }
}

@media (max-width: 900px) {
  .topbar { padding: .55rem max(.6rem, env(safe-area-inset-left)) .65rem max(.6rem, env(safe-area-inset-right)); }
  .topbar-inner {
    grid-template-columns: 1fr auto;
    gap: .55rem;
  }
  .brand small { display: none; }
  .top-actions .user-pill { display: none; }
  .top-actions .logout-pill { display: inline-flex; min-height: 38px; padding-inline: .65rem; }
  .top-nav {
    gap: .35rem;
    overflow: visible;
  }
  .nav-link,
  .nav-summary {
    min-height: 39px;
    padding: .38rem .58rem .38rem .42rem;
    font-size: .92rem;
  }
  .nav-icon {
    width: 1.35rem;
    height: 1.35rem;
    font-size: .88rem;
  }
  .dropdown-menu {
    top: calc(100% + .45rem);
  }
  .authenticated .container {
    width: min(100% - 1rem, 1320px);
    margin-top: .85rem;
  }
  .stats-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
  .brand span:last-child { max-width: 58vw; }
  .top-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .nav-link,
  .nav-summary {
    width: 100%;
    justify-content: flex-start;
    min-width: 0;
  }
  .nav-link > span:last-child,
  .nav-summary > span:nth-child(2) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-dropdown {
    min-width: 0;
  }
  .dropdown-menu,
  .dropdown-menu.admin-menu {
    left: 0;
    width: min(92vw, 360px);
  }
  .stats-grid.three { grid-template-columns: 1fr; }
  .low-stock-alert .section-head { align-items: stretch; }
}

@media print {
  .topbar { display: none !important; }
  .authenticated .container { width: 100%; margin: 0; }
}

/* 2026-05 compact command menu: small header + spacious flyout */
.topbar {
  padding-block: .5rem;
}
.compact-menu-shell {
  max-width: 1320px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.compact-brand {
  min-width: 0;
  flex: 0 1 auto;
}
.compact-brand .brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.04;
}
.compact-brand .brand-copy strong {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-menu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
  min-width: 0;
}
.quick-link,
.menu-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.10);
  color: white;
  padding: .45rem .75rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: none;
}
.quick-link:hover,
.quick-link.active,
.menu-trigger:hover,
.app-menu[open] .menu-trigger {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.32);
}
.quick-link.customer {
  border-color: transparent;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  box-shadow: 0 12px 24px rgba(20,184,166,.22);
}
.quick-link.customer:hover,
.quick-link.customer.active {
  background: linear-gradient(135deg, #14b8a6, #2563eb);
}
.quick-icon {
  width: 1.45rem;
  height: 1.45rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  flex: 0 0 auto;
}
.app-menu {
  position: relative;
}
.app-menu summary {
  list-style: none;
}
.app-menu summary::-webkit-details-marker {
  display: none;
}
.hamburger {
  width: 1.35rem;
  height: 1.1rem;
  display: grid;
  gap: .22rem;
  align-content: center;
}
.hamburger span {
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.app-menu-panel {
  position: absolute;
  top: calc(100% + .7rem);
  right: 0;
  z-index: 90;
  width: min(760px, calc(100vw - 2rem));
  max-height: min(78vh, 760px);
  overflow: auto;
  padding: .85rem;
  border-radius: 24px;
  border: 1px solid rgba(217,225,236,.95);
  background: rgba(255,255,255,.98);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(15,23,42,.26);
  backdrop-filter: blur(18px);
}
.menu-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .8rem .9rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #101828, #115e59);
  color: white;
  margin-bottom: .75rem;
}
.menu-user-card strong,
.menu-user-card small {
  display: block;
}
.menu-user-card small {
  opacity: .78;
  font-weight: 750;
  margin-top: .1rem;
}
.logout-mini {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .45rem .7rem;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color: white;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}
.menu-section {
  padding: .55rem 0 .4rem;
}
.menu-section + .menu-section {
  border-top: 1px solid var(--border);
}
.menu-section h2 {
  margin: 0 0 .55rem;
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 950;
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}
.menu-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.menu-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon title" "icon text";
  column-gap: .65rem;
  row-gap: .08rem;
  align-items: center;
  min-height: 74px;
  padding: .72rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(15,23,42,.045);
}
.menu-item > span {
  grid-area: icon;
  width: 2.3rem;
  height: 2.3rem;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #ccfbf1, #eff6ff);
  color: var(--primary-dark);
  font-weight: 950;
}
.menu-item strong {
  grid-area: title;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .96rem;
}
.menu-item small {
  grid-area: text;
  min-width: 0;
  color: var(--muted);
  font-weight: 720;
  line-height: 1.25;
}
.menu-item:hover,
.menu-item.active {
  border-color: #99f6e4;
  background: linear-gradient(135deg, #ecfeff, #eff6ff);
  color: var(--primary-dark);
}
.menu-item:hover small,
.menu-item.active small {
  color: #155e75;
}
.admin-section .menu-item > span {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  color: #92400e;
}
.authenticated .container {
  width: min(1320px, calc(100% - 2rem));
  margin-top: 1.05rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 760px) {
  .topbar {
    padding: .48rem max(.55rem, env(safe-area-inset-left)) .55rem max(.55rem, env(safe-area-inset-right));
  }
  .compact-menu-shell {
    gap: .45rem;
  }
  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }
  .compact-brand .brand-copy strong {
    max-width: 34vw;
  }
  .compact-brand .brand-copy small {
    display: none;
  }
  .quick-link,
  .menu-trigger {
    min-height: 40px;
    padding: .42rem .58rem;
  }
  .quick-label {
    display: none;
  }
  .quick-icon {
    margin: 0;
  }
  .app-menu-panel {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    right: .55rem;
    left: .55rem;
    width: auto;
    max-height: calc(100dvh - 72px);
    padding: .65rem;
    border-radius: 22px;
  }
  .menu-grid,
  .menu-grid.two {
    grid-template-columns: 1fr;
  }
  .menu-item {
    min-height: 66px;
  }
  .authenticated .container {
    width: min(100% - 1rem, 1320px);
    margin-top: .8rem;
  }
}

@media (max-width: 430px) {
  .compact-brand .brand-copy {
    display: none;
  }
  .quick-menu {
    flex: 1 1 auto;
  }
  .quick-link,
  .menu-trigger {
    flex: 1 1 0;
    padding-inline: .45rem;
  }
  .app-menu {
    flex: 1 1 0;
  }
  .app-menu .menu-trigger {
    width: 100%;
  }
  .menu-user-card {
    align-items: stretch;
    flex-direction: column;
  }
  .logout-mini {
    width: 100%;
  }
}

@media print {
  .topbar { display: none !important; }
  .authenticated .container { width: 100%; margin: 0; }
}

/* 2026-05: Sammel-Kundenausbuchung und anpassbare Bestandslisten */
.compact-section-head {
  margin-top: .25rem;
  align-items: end;
}
.print-settings {
  border: 1px solid #bae6fd;
  background: linear-gradient(135deg, #f8fafc, #ecfeff);
}
/* Druckoptionen: breite, robuste Desktop-Aufteilung ohne kollidierende Labels */
.print-settings-form {
  display: grid;
  grid-template-columns: minmax(210px, .8fr) minmax(360px, 1.55fr) minmax(190px, .72fr) minmax(300px, auto);
  gap: 1rem;
  align-items: end;
}
.print-settings-intro {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.print-settings-form h2 {
  margin: 0;
  flex: 0 0 auto;
}
.print-settings-intro .muted {
  margin: 0;
  max-width: 760px;
}
.print-design-field {
  min-width: 0;
}
.print-design-field select {
  width: 100%;
  min-width: 0;
}
.print-columns {
  min-width: 0;
  margin: 0;
  padding: .72rem .85rem .78rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: .5rem 1rem;
}
.print-columns legend {
  padding: 0 .35rem;
  color: var(--muted);
  font-weight: 950;
  font-size: .85rem;
}
.print-columns .check-row {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .55rem;
}
.print-columns .check-row span {
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.hide-zero-row {
  min-height: 52px;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .6rem;
}
.hide-zero-row span {
  line-height: 1.25;
}
.print-settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  margin: 0;
}
.print-settings-actions .btn {
  width: 100%;
  white-space: nowrap;
}
.print-title {
  display: none;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.print-title h2,
.print-title p {
  margin: 0;
}
.stock-print-card.print-design-compact th,
.stock-print-card.print-design-compact td {
  padding: .5rem .55rem;
  font-size: .88rem;
}
.stock-print-card.print-design-large th,
.stock-print-card.print-design-large td {
  padding: 1.05rem 1rem;
  font-size: 1.05rem;
}
.warehouse-card-actions {
  display: grid;
  gap: .65rem;
}
.warehouse-card-actions:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
@media (max-width: 1240px) {
  .print-settings-form {
    grid-template-columns: minmax(200px, .75fr) minmax(340px, 1.4fr) minmax(180px, .7fr);
  }
  .print-settings-actions {
    grid-column: 1 / -1;
    justify-self: end;
    width: min(100%, 420px);
  }
}
@media (max-width: 900px) {
  .print-settings-form {
    grid-template-columns: 1fr 1fr;
  }
  .print-columns {
    grid-column: 1 / -1;
  }
  .print-settings-actions {
    grid-column: 1 / -1;
    width: 100%;
  }
}
@media (max-width: 760px) {
  .compact-section-head {
    align-items: stretch;
  }
  .compact-section-head .btn {
    width: 100%;
  }
  .print-settings-form,
  .print-columns,
  .print-settings-actions {
    grid-template-columns: 1fr;
  }
  .print-settings-form > *,
  .print-settings-actions {
    grid-column: 1 / -1;
  }
  .print-settings-intro {
    display: block;
  }
  .print-settings-intro .muted {
    margin-top: .35rem;
  }
}
@media print {
  @page {
    margin: 12mm;
  }
  .no-print,
  .print-settings,
  .stock-list-screen-head,
  .print-head .actions-row,
  .flash {
    display: none !important;
  }
  .print-title {
    display: flex;
  }
  .stock-print-card {
    padding: 0 !important;
  }
  .stock-print-card .table-wrap {
    border: 0;
    overflow: visible;
  }
  .stock-print-card table {
    width: 100%;
    min-width: 0;
    font-size: 10.5pt;
  }
  .stock-print-card th,
  .stock-print-card td {
    border: 1px solid #d0d5dd;
    padding: 6px 7px;
  }
  .stock-print-card.print-design-compact table {
    font-size: 9pt;
  }
  .stock-print-card.print-design-compact th,
  .stock-print-card.print-design-compact td {
    padding: 4px 5px;
  }
  .stock-print-card.print-design-large table {
    font-size: 12pt;
  }
  .stock-print-card.print-design-large th,
  .stock-print-card.print-design-large td {
    padding: 9px 8px;
  }
}

/* QR-/Barcode-Scanner */
.product-scan-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: stretch;
}

.product-scan-field select {
  min-width: 0;
}

.scan-btn {
  min-height: 44px;
  white-space: nowrap;
  padding-inline: 0.85rem;
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(6px);
}

.scanner-overlay[hidden] {
  display: none;
}

.scanner-modal {
  width: min(92vw, 640px);
  border-radius: 26px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.38);
  overflow: hidden;
}

.scanner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

.scanner-head strong {
  display: block;
  font-size: 1.05rem;
}

.scanner-head small {
  display: block;
  margin-top: 0.25rem;
  color: #64748b;
}

.scanner-video-wrap {
  position: relative;
  margin: 1rem;
  overflow: hidden;
  border-radius: 20px;
  background: #020617;
  aspect-ratio: 4 / 3;
}

.scanner-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(20, 184, 166, 0.94);
  border-radius: 22px;
  box-shadow: 0 0 0 999px rgba(2, 6, 23, 0.18), 0 0 28px rgba(20, 184, 166, 0.42);
}

.scanner-status {
  min-height: 1.4rem;
  margin: 0 1rem 1rem;
  padding: 0.8rem 0.95rem;
  border-radius: 16px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.95rem;
}

.scanner-status[data-tone="success"] {
  background: #dcfce7;
  color: #166534;
}

.scanner-status[data-tone="error"] {
  background: #fee2e2;
  color: #991b1b;
}

.edit-details {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.edit-details summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  list-style: none;
}

.edit-details summary::-webkit-details-marker {
  display: none;
}

.edit-details summary small {
  display: block;
  color: #64748b;
  margin-top: 0.15rem;
}

.inline-edit-form {
  padding: 0 1rem 1rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.check-row input {
  width: auto;
}

@media (max-width: 640px) {
  .product-scan-field {
    grid-template-columns: 1fr;
  }

  .scan-btn {
    width: 100%;
    justify-content: center;
  }

  .scanner-modal {
    width: 100%;
    border-radius: 22px;
  }

  .scanner-head {
    flex-direction: column;
  }

  .scanner-head .btn {
    width: 100%;
  }
}

/* 2026-08 Seriennummern-Erfassung */
.transfer-line {
  grid-template-columns: minmax(220px, 1fr) 110px minmax(240px, .95fr) auto;
  align-items: start;
}
.transfer-line-head {
  grid-template-columns: minmax(220px, 1fr) 110px minmax(240px, .95fr) auto;
}
.serial-capture {
  display: grid;
  gap: .45rem;
  min-width: 0;
  padding: .6rem;
  border: 1px dashed #99f6e4;
  border-radius: 16px;
  background: linear-gradient(135deg, #f8fafc, #ecfeff);
}
.serial-capture[hidden] {
  display: none !important;
}
.serial-capture textarea {
  min-height: 92px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: .02em;
}
.serial-actions {
  gap: .4rem;
  flex-wrap: wrap;
}
.readonly-field {
  background: #eefcf9 !important;
  color: #0f766e;
  font-weight: 950;
}
@media (max-width: 900px) {
  .transfer-line,
  .transfer-line-head {
    grid-template-columns: 1fr;
  }
}
@media print {
  .serial-capture .serial-actions {
    display: none !important;
  }
}

/* Scanner: gut sichtbare letzte Erkennung + kurzer Scan-Ton wird in app.js erzeugt */
.scanner-last {
  margin: 0 1rem .75rem;
  padding: .95rem 1rem;
  border-radius: 18px;
  border: 2px solid rgba(20, 184, 166, .38);
  background: linear-gradient(135deg, #ecfeff, #f0fdfa);
  color: #0f172a;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .10);
}

.scanner-last[hidden] {
  display: none;
}

.scanner-last span {
  display: block;
  margin-bottom: .35rem;
  color: #0f766e;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.scanner-last strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  line-height: 1.1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.scanner-last[data-tone="error"] {
  border-color: rgba(239, 68, 68, .35);
  background: linear-gradient(135deg, #fff1f2, #fee2e2);
}

.scanner-last[data-tone="error"] span {
  color: #b91c1c;
}

.scanner-last-pulse {
  animation: scannerLastPulse .42s ease-out;
}

@keyframes scannerLastPulse {
  0% { transform: scale(.985); box-shadow: 0 0 0 0 rgba(20, 184, 166, .34); }
  65% { transform: scale(1.012); box-shadow: 0 0 0 12px rgba(20, 184, 166, 0); }
  100% { transform: scale(1); box-shadow: 0 14px 34px rgba(15, 23, 42, .10); }
}

.serial-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .35rem 0 .15rem;
}

.serial-preview[hidden] {
  display: none !important;
}

.serial-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: .38rem .55rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .88rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.serial-chip.newest {
  background: #ccfbf1;
  color: #115e59;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .18);
}

.form-actions-row { justify-content: flex-start; margin-top: .25rem; }
.full-help { grid-column: 1 / -1; margin: -.25rem 0 0; }
.serial-summary-grid { align-items: stretch; }
.balance-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem .9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
}
.tiny-stack { gap: .55rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; letter-spacing: .02em; }
@media (max-width: 760px) {
  .balance-row { flex-direction: column; gap: .25rem; }
}

.js-warehouse-field.is-muted {
  opacity: .62;
}
.js-warehouse-field.is-muted select {
  cursor: not-allowed;
}

/* 2026-08 Admin: Seriennummern löschen und Bericht-Branding */
.branding-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
  margin: .85rem 0 1rem;
}
.branding-preview {
  display: grid;
  gap: .6rem;
  align-content: start;
  min-height: 126px;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f8fafc;
}
.branding-logo-preview {
  width: min(100%, 320px);
  max-height: 96px;
  object-fit: contain;
  object-position: left center;
  padding: .45rem;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--border);
}
.branding-favicon-preview {
  width: 56px;
  height: 56px;
  object-fit: contain;
  padding: .35rem;
  border-radius: 15px;
  background: white;
  border: 1px solid var(--border);
}
.empty-preview {
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-weight: 850;
  background: white;
}
.branding-form {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
}
.serial-delete-card {
  border-color: #fecaca;
  background: linear-gradient(135deg, #fff7ed, #fff1f2);
}
.serial-delete-actions {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: .85rem;
  align-items: end;
  margin-bottom: .85rem;
}
.serial-delete-form input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
}
.report-title-main {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.report-logo {
  max-width: 210px;
  max-height: 58px;
  object-fit: contain;
  object-position: left center;
}
@media (max-width: 760px) {
  .branding-preview-grid,
  .branding-form,
  .serial-delete-actions {
    grid-template-columns: 1fr;
  }
}
@media print {
  .report-logo {
    max-width: 58mm;
    max-height: 18mm;
  }
}

.delete-inline-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* 2026-08: DIN-A4-Listen, Einbuchungsjournal und manuelle Seriennummernauswahl */
.a4-list,
.a4-sheet {
  width: min(100%, 210mm);
  margin-inline: auto;
}

.journal-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .65rem;
  margin-bottom: 1rem;
}
.journal-meta div {
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}
.journal-meta span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.journal-meta strong {
  display: block;
  margin-top: .18rem;
  overflow-wrap: anywhere;
}
.journal-reason {
  padding: .75rem .85rem;
  border-radius: 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.journal-serial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: .6rem;
}
.journal-serial-card {
  break-inside: avoid;
  padding: .55rem;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
}
.journal-serial-card strong {
  display: block;
  margin-bottom: .35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}
.journal-serial-card img {
  width: 100%;
  max-height: 52px;
  object-fit: contain;
  object-position: left center;
  image-rendering: crisp-edges;
}
.serial-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(6px);
}
.serial-picker-overlay[hidden] { display: none; }
.serial-picker-modal {
  width: min(94vw, 720px);
  max-height: min(90dvh, 760px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 26px;
  background: white;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.38);
}
.serial-picker-body {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  overflow: auto;
}
.serial-picker-list {
  display: grid;
  gap: .45rem;
}
.serial-picker-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .55rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  cursor: pointer;
}
.serial-picker-item[hidden] { display: none !important; }
.serial-picker-item input {
  width: 22px;
  min-height: 22px;
}
.serial-picker-item strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.serial-picker-footer {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  background: #f8fafc;
}

@media (max-width: 900px) {
  .journal-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .journal-meta { grid-template-columns: 1fr; }
  .serial-picker-footer .btn { width: 100%; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body {
    width: 210mm;
    min-height: 297mm;
    background: #fff !important;
  }
  body {
    font-size: 10.5pt;
    color: #111827;
  }
  .a4-list,
  .a4-sheet,
  .journal-print-card,
  .stock-print-card,
  .inventory-table,
  .journal-table {
    width: 100% !important;
    max-width: 186mm !important;
    margin-inline: auto !important;
  }
  .page-head,
  .card {
    break-inside: avoid;
  }
  .journal-print-card {
    padding: 0 !important;
  }
  .journal-meta {
    grid-template-columns: repeat(3, 1fr);
    gap: 4mm;
  }
  .journal-meta div {
    padding: 3mm;
    border-radius: 0;
  }
  .journal-table-wrap,
  .journal-table-wrap.table-wrap {
    border: 0;
    overflow: visible;
  }
  .journal-table,
  .inventory-table,
  table {
    page-break-inside: auto;
  }
  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  th, td {
    padding: 4mm 3mm;
  }
  .journal-serial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3mm;
  }
  .journal-serial-card {
    border-radius: 0;
    padding: 2.5mm;
  }
  .journal-serial-card img {
    max-height: 17mm;
  }
}

/* 2026-08 remember login controls */
.check-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .75rem;
  padding: .85rem .95rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
  font-weight: 800;
}
.check-card input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  margin-top: .1rem;
  accent-color: var(--primary);
}
.check-card strong,
.check-card small { display: block; }
.check-card small,
.login-note { color: var(--muted); font-weight: 650; line-height: 1.35; }
.remember-login-option { background: linear-gradient(135deg, #f0fdfa, #eff6ff); border-color: #99f6e4; }
.compact-settings-form { grid-template-columns: minmax(260px, 1fr) auto; align-items: center; }
.setting-toggle { background: white; }
@media (max-width: 900px) {
  .compact-settings-form { grid-template-columns: 1fr; }
}


/* Kunden-Ausgang: revisionssichere Rueckbuchung im Popup */
.movement-admin-actions {
  display: grid;
  gap: .45rem;
  min-width: 150px;
}
.rollback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 7, 18, .72);
  backdrop-filter: blur(6px);
}
.rollback-overlay[hidden] { display: none; }
.rollback-modal {
  width: min(94vw, 700px);
  max-height: min(92dvh, 820px);
  overflow: hidden;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .38);
}
.rollback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, .24);
}
.rollback-head h2 { margin: .1rem 0 .25rem; }
.rollback-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  max-height: calc(92dvh - 120px);
}
.rollback-body {
  display: grid;
  gap: .9rem;
  padding: 1.1rem;
  overflow: auto;
}
.rollback-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}
.rollback-summary div,
.rollback-serials {
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #f8fafc;
}
.rollback-summary span,
.rollback-serials span {
  display: block;
  margin-bottom: .2rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rollback-summary strong,
.rollback-serials strong {
  overflow-wrap: anywhere;
}
.rollback-serials strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}
.rollback-confirm {
  border-color: #fecaca;
  background: var(--danger-soft);
}
.rollback-footer {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  padding: 1rem 1.1rem;
  border-top: 1px solid rgba(148, 163, 184, .24);
  background: #f8fafc;
}
@media (max-width: 560px) {
  .rollback-summary { grid-template-columns: 1fr; }
  .rollback-footer { flex-direction: column-reverse; }
  .rollback-footer .btn { width: 100%; }
}

.rollback-row-status {
  display: inline-block;
  margin-top: .35rem;
  color: var(--success);
  font-size: .78rem;
  font-weight: 900;
}

/* 2026-09 Tabellen: alles lesen ohne horizontales Scrollen */
@media screen {
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .table-wrap table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .table-wrap th,
  .table-wrap td {
    min-width: 0;
    max-width: 100%;
    padding: .52rem .46rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.28;
  }
  .table-wrap th {
    font-size: clamp(.62rem, .68vw, .76rem);
    letter-spacing: .015em;
  }
  .table-wrap td {
    font-size: clamp(.72rem, .78vw, .9rem);
  }
  .table-wrap .badge,
  .table-wrap .status-pill,
  .table-wrap .pill {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }
  .table-wrap .btn.small {
    max-width: 100%;
    padding: .4rem .5rem;
    font-size: .76rem;
    white-space: normal;
  }
  .table-wrap input,
  .table-wrap select,
  .table-wrap textarea,
  .table-wrap details,
  .table-wrap form,
  .table-wrap .movement-admin-actions,
  .table-wrap .inline-correction {
    min-width: 0;
    max-width: 100%;
  }
  .movement-admin-actions {
    min-width: 0;
  }
}

@media screen and (max-width: 760px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .table-wrap table,
  .table-wrap tbody {
    display: block;
    width: 100%;
  }
  .table-wrap table {
    table-layout: auto;
    background: transparent;
  }
  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .table-wrap tbody {
    display: grid;
    gap: .75rem;
  }
  .table-wrap tbody tr {
    display: grid;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
  }
  .table-wrap tbody td {
    display: grid;
    grid-template-columns: minmax(7.2rem, 34%) minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    width: 100%;
    padding: .68rem .75rem;
    border-bottom: 1px solid var(--border);
    font-size: .86rem;
  }
  .table-wrap tbody td:last-child {
    border-bottom: 0;
  }
  .table-wrap tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .69rem;
    font-weight: 950;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .035em;
    overflow-wrap: anywhere;
  }
  .table-wrap tbody td[data-label=""],
  .table-wrap tbody td[colspan] {
    grid-template-columns: 1fr;
  }
  .table-wrap tbody td[data-label=""]::before,
  .table-wrap tbody td[colspan]::before {
    display: none;
  }
  .table-wrap tbody td > *,
  .table-wrap tbody td > form,
  .table-wrap tbody td > details {
    min-width: 0;
    max-width: 100%;
  }
  .table-wrap .inline-correction,
  .table-wrap .movement-admin-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }
  .journal-serial-grid {
    grid-template-columns: 1fr;
  }
}

/* Backup- und Wiederherstellungskonsole */
.backup-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
}
.backup-status-card {
  display: grid;
  gap: .3rem;
  min-width: 0;
}
.backup-status-card > span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.backup-status-card strong,
.backup-status-card small,
.backup-filename {
  overflow-wrap: anywhere;
}
.backup-status-card small {
  color: var(--muted);
}
.backup-list {
  display: grid;
  gap: .7rem;
}
.backup-card {
  display: grid;
  gap: .7rem;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f8fafc;
}
.backup-card.backup-invalid {
  border-color: #fecaca;
  background: #fff7f7;
}
.backup-card-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  min-width: 0;
}
.backup-card-main > div:first-child {
  min-width: 0;
}
.backup-card-main small {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
}
.backup-badges,
.backup-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.backup-actions form {
  margin: 0;
}
.backup-restore-panel {
  min-width: min(100%, 320px);
}
.backup-restore-panel > summary {
  list-style: none;
  cursor: pointer;
}
.backup-restore-panel > summary::-webkit-details-marker {
  display: none;
}
.backup-confirm-form {
  display: grid;
  gap: .65rem;
  margin-top: .55rem;
  padding: .75rem;
  border: 1px solid #fecaca;
  border-radius: 16px;
  background: #fff;
}
.backup-confirm-form p {
  margin: 0;
}
.backup-upload-form {
  max-width: 860px;
}

@media (max-width: 900px) {
  .backup-status-grid {
    grid-template-columns: 1fr;
  }
  .backup-card-main {
    flex-direction: column;
  }
}
@media (max-width: 560px) {
  .backup-actions,
  .backup-actions > *,
  .backup-actions .btn,
  .backup-restore-panel {
    width: 100%;
  }
}

/* 2026-09 Automatische Materialmeldung / SMTP */
.report-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}
.report-status-card {
  display: grid;
  gap: .28rem;
  min-width: 0;
}
.report-status-card > span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.report-status-card strong,
.report-status-card small {
  overflow-wrap: anywhere;
}
.report-status-card small { color: var(--muted); }
.report-settings-form {
  display: grid;
  gap: 1rem;
}
.report-enable-card {
  background: linear-gradient(135deg, #f0fdfa, #eff6ff);
  border-color: #99f6e4;
}
.report-form-grid.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.compact-check-card {
  align-self: end;
  min-height: 46px;
  padding: .62rem .75rem;
  background: #fff;
}
.report-subhead {
  margin-top: .35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.report-message-grid {
  grid-template-columns: 1fr;
}
.report-message-grid textarea {
  min-height: 180px;
}
.report-save-actions,
.report-secondary-actions {
  margin-top: .35rem;
}
.report-secondary-actions {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.report-template-actions {
  display: grid;
  gap: .9rem;
}
.report-template-upload {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}
.report-error-text {
  display: block;
  margin-top: .35rem;
  color: var(--danger);
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

@media (max-width: 1000px) {
  .report-form-grid.three-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .report-status-grid,
  .report-form-grid.three-cols,
  .report-template-upload { grid-template-columns: 1fr; }
  .report-secondary-actions > *,
  .report-secondary-actions .btn { width: 100%; }
}

/* Materialmeldung: ausgeblendete Rhythmus-Felder duerfen nicht vom globalen label-Layout eingeblendet werden. */
[data-material-report-schedule-option][hidden] {
  display: none !important;
}

/* Materialmeldung: robuste Sichtbarkeit der rhythmusabhaengigen Felder. */
.schedule-option-hidden,
[data-material-report-schedule-option][hidden] {
  display: none !important;
}

/* Excel-Vorlagendesigner: Logo und Stempel/Unterschrift */
.report-designer-form {
  display: grid;
  gap: 1rem;
}
.report-designer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.report-graphic-card {
  display: grid;
  gap: .9rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card, #fff);
  min-width: 0;
}
.report-graphic-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}
.report-graphic-card-head h3 {
  margin: 0 0 .2rem;
}
.report-graphic-card-head p {
  margin: 0;
}
.report-graphic-preview {
  min-height: 150px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, .08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, .08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, .08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, .08) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: .75rem;
  color: var(--muted);
  text-align: center;
}
.report-graphic-preview.stamp {
  min-height: 180px;
}
.report-graphic-preview img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
}
.report-graphic-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.report-graphic-fields > label:first-child {
  grid-column: 1 / -1;
}
.switch-line {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  font-weight: 800;
}
.report-designer-hint {
  padding: .85rem 1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.45;
}
@media (max-width: 900px) {
  .report-designer-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .report-graphic-fields {
    grid-template-columns: 1fr;
  }
  .report-graphic-fields > label:first-child {
    grid-column: auto;
  }
  .report-graphic-card-head {
    flex-direction: column;
  }
}

/* 2026-09 Buchungsjournal: kombinierte Filter und Materialmeldungsstatus */
.journal-filter-card {
  margin-bottom: 1rem;
}
.journal-filter-form {
  display: grid;
  gap: .9rem;
}
.journal-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  align-items: end;
}
.journal-filter-grid label {
  min-width: 0;
}
.journal-filter-grid select,
.journal-filter-grid input {
  width: 100%;
  min-width: 0;
}
.journal-filter-grid .filter-span-2 {
  grid-column: span 2;
}
.journal-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.status-pill.pending {
  color: #92400e;
  background: #fef3c7;
}
.journal-report-link {
  display: inline-block;
  margin-top: .2rem;
  font-size: .78rem;
  font-weight: 850;
}
@media (max-width: 980px) {
  .journal-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .journal-filter-grid { grid-template-columns: 1fr; }
  .journal-filter-grid .filter-span-2 { grid-column: auto; }
  .journal-filter-actions { align-items: stretch; flex-direction: column; }
}

.movement-reported-row > td {
  background: rgba(22, 163, 74, .035);
}

/* 2026-09 Kompakte, einklappbare Navigation/Einstellungen/Filter */
.menu-section-details {
  padding: .25rem 0;
}
.menu-section-details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .35rem;
  cursor: pointer;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .78rem;
  font-weight: 950;
  user-select: none;
}
.menu-section-details > summary::-webkit-details-marker { display: none; }
.menu-section-details > summary:hover { color: var(--primary-dark); }
.menu-section-details .menu-section-chevron {
  font-size: 1rem;
  transition: transform .18s ease;
}
.menu-section-details[open] .menu-section-chevron { transform: rotate(180deg); }
.menu-section-details > .menu-grid { margin: 0 0 .55rem; }

.collapsible-panel {
  overflow: hidden;
}
.collapsible-panel > summary.collapsible-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  padding: .15rem 0;
  min-height: 44px;
  user-select: none;
}
.collapsible-panel > summary.collapsible-summary::-webkit-details-marker { display: none; }
.collapsible-summary > span:first-child {
  display: grid;
  gap: .1rem;
  min-width: 0;
}
.collapsible-summary strong {
  font-size: 1.02rem;
  line-height: 1.25;
}
.collapsible-summary-meta {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.admin-collapsible > summary .collapsible-summary-meta {
  font-size: 0;
}
.admin-collapsible > summary .collapsible-summary-meta::after {
  content: "Aufklappen  ▾";
  font-size: .82rem;
}
.admin-collapsible[open] > summary .collapsible-summary-meta::after {
  content: "Zuklappen  ▴";
}
.collapsible-panel > .collapsible-content {
  padding-top: 1rem;
  margin-top: .7rem;
  border-top: 1px solid var(--border);
}
.journal-filter-card.collapsible-panel > .collapsible-content {
  padding-top: .85rem;
}
@media (max-width: 620px) {
  .collapsible-panel > summary.collapsible-summary {
    align-items: flex-start;
  }
  .collapsible-summary-meta {
    white-space: normal;
    max-width: 48%;
  }
}


/* Superadmin / Rechteverwaltung */
.permission-editor { margin: .75rem 0; }
.permission-editor > summary { cursor: pointer; padding: .65rem .8rem; border-radius: .7rem; background: var(--surface-soft, #f4f7f7); }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .65rem; margin-top: .75rem; }
.permission-card { min-height: 86px; align-items: flex-start; }
.permission-card small { display: block; margin-top: .2rem; line-height: 1.35; }
.soft-card { background: var(--surface-soft, #f7f9f9); box-shadow: none; }

/* 2026-09 Inventur: Korrekturbuchung immer vollstaendig sichtbar */
.inventory-table.has-correction th:nth-child(1),
.inventory-table.has-correction td:nth-child(1) { width: 27%; }
.inventory-table.has-correction th:nth-child(2),
.inventory-table.has-correction td:nth-child(2) { width: 16%; }
.inventory-table.has-correction th:nth-child(3),
.inventory-table.has-correction td:nth-child(3) { width: 15%; }
.inventory-table.has-correction th:nth-child(4),
.inventory-table.has-correction td:nth-child(4) { width: 42%; }

.inventory-table .inventory-correction-cell {
  overflow: visible;
}
.inventory-table .inventory-correction-form {
  display: grid;
  grid-template-columns: minmax(72px, 92px) minmax(0, 1fr);
  gap: .5rem;
  align-items: end;
  width: 100%;
  min-width: 0;
}
.inventory-table .inventory-correction-form input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.inventory-table .inventory-correction-form .btn,
.inventory-table .inventory-correction-form .full-help {
  grid-column: 1 / -1;
}
.inventory-table .inventory-correction-form .btn {
  width: 100%;
  min-height: 42px;
  white-space: normal;
}

/* Bereits auf Tablets in Karten wechseln, damit die Aktionsspalte nie abgeschnitten wird. */
@media screen and (max-width: 1100px) {
  .inventory-table-wrap {
    overflow: visible !important;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .inventory-table-wrap .inventory-table,
  .inventory-table-wrap .inventory-table tbody {
    display: block;
    width: 100%;
  }
  .inventory-table-wrap .inventory-table {
    table-layout: auto;
    background: transparent;
  }
  .inventory-table-wrap .inventory-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .inventory-table-wrap .inventory-table tbody {
    display: grid;
    gap: .75rem;
  }
  .inventory-table-wrap .inventory-table tbody tr {
    display: grid;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
  }
  .inventory-table-wrap .inventory-table tbody td,
  .inventory-table-wrap .inventory-table.has-correction tbody td:nth-child(n) {
    display: grid;
    grid-template-columns: minmax(8rem, 32%) minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    width: 100%;
    padding: .68rem .75rem;
    border-bottom: 1px solid var(--border);
    font-size: .88rem;
  }
  .inventory-table-wrap .inventory-table tbody td:last-child {
    border-bottom: 0;
  }
  .inventory-table-wrap .inventory-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .69rem;
    font-weight: 950;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .035em;
    overflow-wrap: anywhere;
  }
  .inventory-table-wrap .inventory-table tbody td > * {
    min-width: 0;
    max-width: 100%;
  }
  .inventory-table-wrap .inventory-correction-form {
    grid-template-columns: minmax(76px, 96px) minmax(0, 1fr);
    width: 100%;
  }
}

@media screen and (max-width: 620px) {
  .inventory-table-wrap .inventory-table tbody td,
  .inventory-table-wrap .inventory-table.has-correction tbody td:nth-child(n) {
    grid-template-columns: 1fr;
    gap: .35rem;
  }
  .inventory-table-wrap .inventory-correction-form {
    grid-template-columns: 1fr;
  }
  .inventory-table-wrap .inventory-correction-form .btn,
  .inventory-table-wrap .inventory-correction-form .full-help {
    grid-column: auto;
  }
}

/* 2026-09 Sammelinventur: mehrere Positionen gemeinsam speichern */
.inventory-bulk-form {
  display: grid;
  gap: .9rem;
}
.inventory-bulk-head,
.inventory-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
}
.inventory-bulk-head > div {
  display: grid;
  gap: .2rem;
}
.inventory-bulk-head small {
  color: var(--muted);
  line-height: 1.35;
}
.inventory-bulk-actions {
  position: sticky;
  bottom: .65rem;
  z-index: 8;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
}
.inventory-bulk-actions .btn,
.inventory-bulk-head .btn {
  flex: 0 0 auto;
  min-height: 44px;
}
.inventory-table tr.inventory-row-changed {
  background: #fffaf0;
}
.inventory-table tr.inventory-row-changed td:first-child {
  box-shadow: inset 4px 0 0 #d97706;
}
.inventory-count-field,
.inventory-reason-field {
  display: block;
  min-width: 0;
}
@media screen and (max-width: 760px) {
  .inventory-bulk-head {
    align-items: stretch;
    flex-direction: column;
  }
  .inventory-bulk-head .btn {
    width: 100%;
  }
  .inventory-bulk-actions {
    align-items: stretch;
    flex-direction: column;
    bottom: .35rem;
  }
  .inventory-bulk-actions .btn {
    width: 100%;
  }
}
@media print {
  .inventory-bulk-head,
  .inventory-bulk-actions {
    display: none !important;
  }
}
