[hidden] {
  display: none !important;
}

nav {
  grid-template-columns: repeat(4, 1fr);
}

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.app { position: relative; display: grid; grid-template-rows: 72px minmax(0,1fr) 72px; height: 100dvh; min-height: 0; padding-bottom: 0; overflow: hidden; }
.app > header { height: 72px; }
.app > main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 16px; }
.app > nav { position: static; inset: auto; transform: none; width: 100%; height: 72px; }
nav:has([data-office-nav]) { grid-template-columns: repeat(5, 1fr); }
nav:has([data-admin-nav]) { grid-template-columns: repeat(4, 1fr); }

@media(min-width:800px){
  .app { height: calc(100dvh - 40px); }
  .app > nav { bottom: auto; }
}

@media(max-width:799px){
  .app{grid-template-rows:calc(72px + env(safe-area-inset-top)) minmax(0,1fr) calc(72px + env(safe-area-inset-bottom));}
  .app>header{height:calc(72px + env(safe-area-inset-top));padding-top:calc(14px + env(safe-area-inset-top));}
  .app>nav{height:calc(72px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);}
  .header-actions{min-width:0;flex:0 1 auto}.role{max-width:44vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}

.product-picker {
  display: grid;
  grid-template-columns: 1fr 48px;
}

.product-picker input {
  border-radius: 12px 0 0 12px !important;
}

.product-picker button {
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
}

.machine-card[data-machine-detail],
.record-card[data-record-detail] {
  cursor: pointer;
}

.machine-card[data-machine-detail]:focus-visible,
.record-card[data-record-detail]:focus-visible {
  outline: 3px solid #ef715766;
  outline-offset: -3px;
}

.machine-detail,
.record-detail {
  padding: 24px;
}

.machine-detail img,
.machine-photo-empty {
  width: 100%;
  height: 230px;
  border-radius: 16px;
  object-fit: contain;
  background: #f1f3f0;
}

.machine-photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.machine-detail-code {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  height: 42px;
  margin-top: 16px;
  padding: 0 10px;
  border-radius: 11px;
  background: #f4e2de;
  color: #d94b35;
  font-weight: 800;
}

.machine-detail h2,
.record-detail h2 {
  margin: 12px 0 18px;
  font: 700 25px Georgia;
}

.machine-detail dl {
  margin: 0;
}

.machine-detail dl div {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.machine-detail dt {
  color: var(--muted);
}

.machine-detail dd {
  margin: 0;
  font-weight: 700;
}

.record-card {
  position: relative;
  padding-right: 36px;
}

.record-card > i {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 25px;
  font-style: normal;
}

.record-detail p {
  color: var(--muted);
}

.detail-items,
.detail-checks {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.detail-items li,
.detail-checks li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-items li:last-child,
.detail-checks li:last-child {
  border: 0;
}

.detail-checks li::before {
  content: "✓";
  color: var(--green);
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.notifications-button {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid #ffffff33;
  border-radius: 50%;
  background: #ffffff12;
  color: #fff;
  font-size: 22px;
}

.notifications-button b {
  position: absolute;
  right: -3px;
  top: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral);
  font-size: 11px;
  line-height: 18px;
}

.attention-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px;
  padding: 15px;
  border-left: 5px solid var(--coral);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px #10221d0a;
}

.attention-card div { flex: 1; }
.attention-card small { color: var(--coral); font-weight: 800; }
.attention-card h2 { margin: 4px 0; font-size: 17px; }
.attention-card p { margin: 0; color: var(--muted); font-size: 14px; }
.attention-card button { border: 0; border-radius: 10px; background: var(--ink); color: #fff; padding: 10px; }

.product-results {
  position: relative;
  z-index: 4;
  max-height: 260px;
  margin-top: 5px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 30px #10221d25;
}

.product-results button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.product-results button:last-child { border: 0; }
.product-results strong, .product-results small { display: block; }
.product-results small { margin-top: 3px; color: var(--muted); }
.product-results p { padding: 14px; color: var(--muted); }

.profile-card {
  margin: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.profile-card h2 { margin: 0 0 14px; font-size: 18px; }
.profile-card dl { margin: 0; }
.profile-card dl div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.profile-card dt { color: var(--muted); }
.profile-card dd { margin: 0; font-weight: 700; }
.language-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.language-options button { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.language-options button.active { background: var(--ink); color: #fff; }
.profile-logout { width: calc(100% - 28px); margin: 0 14px 18px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #b33a2b; font-weight: 800; }

.notification-list { padding: 24px; }
.notification-list h2 { font: 700 25px Georgia; }
.notification-list article { padding: 13px 0; border-top: 1px solid var(--line); }
.notification-list strong, .notification-list small { display: block; }
.notification-list small { margin-top: 4px; color: var(--muted); }

.office-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 14px 0;
}

.office-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 9px 12px;
}

.office-tabs button.active { background: var(--ink); color: #fff; }

.office-task-group {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.office-task-group span { flex: 1; }
.office-task-group strong, .office-task-group small { display: block; }
.office-task-group small { margin-top: 4px; color: var(--muted); }
.office-task-group > b { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; background: #f4e2de; color: #d94b35; }
.admin-home-group h2 { padding: 0 14px; }
.admin-home-group button { display: flex; justify-content: space-between; width: 100%; padding: 15px; border: 0; border-top: 1px solid var(--line); background: #fff; text-align: left; }

.admin-overview { padding: 18px; }
.admin-overview h2 { margin: 0 0 8px; }
.admin-overview p { margin: 0; color: var(--muted); line-height: 1.5; }
.admin-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.admin-more-grid button { min-height: 104px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
.admin-more-grid b, .admin-more-grid span { display: block; }
.admin-more-grid b { margin-bottom: 8px; color: var(--coral); font-size: 24px; }
.admin-more-grid span { font-weight: 750; }

.office-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #faf8f7; }
.office-filters input, .office-filters select { min-width: 0; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; font: inherit; }
.office-filters input { grid-column: 1 / -1; }
.office-checklist-row .dots { display: flex; margin-top: 10px; }
.delete-record{width:100%;min-height:46px;margin:12px 0;border:1px solid #d9b9b1;border-radius:12px;background:#fff;color:#a23b2a;font-weight:800}
#pullRefresh{position:fixed;z-index:20;top:max(10px,env(safe-area-inset-top));left:50%;transform:translate(-50%,-80px);padding:9px 14px;border-radius:999px;background:#231c1a;color:#fff;font-size:13px;font-weight:800;opacity:0;transition:.18s;pointer-events:none}#pullRefresh.visible{transform:translate(-50%,0);opacity:1}#installApp{width:100%;min-height:48px;margin-top:12px;border:1px solid var(--line);border-radius:13px;background:#fff;color:var(--ink);font-weight:800}
.brand>img{width:42px;height:42px;object-fit:contain;flex:0 0 auto}.login-brand{justify-content:center}.login-brand>img{width:190px;height:auto;max-height:150px}
.non-working-day{padding:20px 18px;background:#f7f3f1}.non-working-day strong,.non-working-day small{display:block}.non-working-day small{margin-top:5px;color:var(--muted)}
.nav-badge { position: absolute; top: 7px; margin-left: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 11px; line-height: 18px; }
nav button { position: relative; }
.attention-actions { display: grid; gap: 6px; }
.attention-actions button:last-child:not(:first-child) { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.role-switcher > button { display: block; width: 100%; padding: 14px 0; border: 0; border-top: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; }
.role-switcher > button strong, .role-switcher > button small { display: block; }
.role-switcher > button small { margin-top: 3px; color: var(--muted); }
.project-checks { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.project-checks label, .active-check { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; }
.project-checks input, .active-check input { width: 20px !important; min-height: 20px !important; }
.form-help { margin: 4px 0 10px !important; color: var(--muted); font-size: 13px !important; line-height: 1.45; }
.stock-row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.stock-row span { flex: 1; }
.stock-row .negative { color: #b33a2b; }
.external-source-note { padding: 16px; border-bottom: 1px solid var(--line); background: #fff7f4; }
.external-source-note b, .external-source-note span { display: block; }
.external-source-note span { margin-top: 5px; color: var(--muted); line-height: 1.45; }
.admin-row-button { width: 100%; border: 0; color: var(--ink); text-align: left; }
.admin-row-button i { font-size: 24px; font-style: normal; }
.office-transfer-block h3 { margin: 18px; }
.office-transfer-block .queue-item button { margin-top: 10px; border: 0; border-radius: 9px; background: var(--ink); color: #fff; padding: 9px 11px; }

/* Office manager navigation is provided by the shared bottom bar. */
#officeTabs { display: none !important; }
html,body{overscroll-behavior-y:contain}
.non-working-day .work-today{display:block;width:100%;margin-top:1rem}
.not-working-today{display:block;width:100%;margin-top:1rem;padding:.85rem 1rem;border:1px solid #cfc5c0;border-radius:14px;background:#fff;color:#6b625e;font:inherit;font-weight:700}
.admin-stats article[data-admin-stat-go]{cursor:pointer}.admin-stats article[data-admin-stat-go]:focus-visible{outline:3px solid #d94b3566;outline-offset:2px}
.shipping-auto-tare{display:block;margin:-4px 0 8px;color:var(--muted);font-size:12px;line-height:1.4}
