[hidden] { display: none !important; }
body { min-width: 0; }
main { min-width: 0; }
.booting > main, .booting > aside, .booting > #cloud-toolbar { visibility: hidden; pointer-events: none; }
#login-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: #f1f5f9; }
.login-card { max-width: 30rem; padding: 2rem; border-radius: 1rem; background: white; box-shadow: 0 12px 40px #0f172a20; text-align: center; }
.admin-action { padding: .6rem 1rem; border-radius: .5rem; border: 1px solid #cbd5e1; color: #3730a3; background: #eef2ff; min-height: 44px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
#cloud-toolbar { position: fixed; right: 1rem; top: .25rem; z-index: 40; display: flex; align-items: center; gap: .75rem; font-size: .75rem; background: #fffffff2; border: 1px solid #e2e8f0; border-radius: 1rem; padding: .2rem .7rem; }
#sync-status { color: #4338ca; }
#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 110; background: #0f172a; color: white; padding: .8rem 1.2rem; border-radius: .6rem; max-width: 90vw; }
.management-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid #e2e8f0; overflow-wrap: anywhere; }
@media screen and (max-width: 767px) {
  body { display: block !important; }
  body > aside.no-print { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; padding: .25rem .2rem calc(.25rem + env(safe-area-inset-bottom)); z-index: 45; }
  body > aside > div:first-child > div, body > aside > div:last-child { display: none; }
  aside nav { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: .1rem; }
  aside nav .nav-btn { flex-direction: column; justify-content: center; gap: .15rem; margin: 0; padding: .4rem .1rem; min-height: 58px; font-size: 10px; line-height: 1.3; }
  aside nav .nav-btn span { margin-left: 0 !important; }
  aside nav .nav-btn svg { height: 20px; width: 20px; }
  body > main.no-print { padding: 3.5rem .75rem calc(6rem + env(safe-area-inset-bottom)); overflow: visible; }
  main .p-6 { padding: 1rem; }
  main .grid, #edit-modal .grid { grid-template-columns: minmax(0,1fr) !important; }
  main [class*='col-span'], #edit-modal [class*='col-span'] { grid-column: auto !important; }
  input:not([type=file]), select, textarea, button, label.cursor-pointer { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; max-width: 100%; }
  input[type=file] { width: 100%; min-height: 44px; }
  main header, #tab-estimates .flex.justify-between, #edit-modal .flex.items-end { flex-wrap: wrap; gap: .75rem; }
  #edit-modal .flex.items-end > div { width: 100%; flex: auto; }
  #estimate-search-keyword { width: 100%; }
  main .overflow-x-auto, #edit-modal .overflow-x-auto { overflow: visible; }
  main table, main tbody, #edit-modal table, #edit-modal tbody { display: block; width: 100%; }
  main thead, #edit-modal thead { display: none; }
  main tbody tr, #edit-modal tbody tr { display: block; padding: .75rem; margin: .75rem 0; border: 1px solid #cbd5e1; border-radius: .6rem; background: white; }
  main tbody td, #edit-modal tbody td { display: grid; grid-template-columns: minmax(5.5rem,35%) minmax(0,1fr); align-items: center; gap: .4rem; width: 100%; padding: .4rem 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  main tbody td::before, #edit-modal tbody td::before { content: attr(data-label); color: #64748b; font-size: 12px; grid-column: 1; }
  main tbody td > *, #edit-modal tbody td > * { grid-column: 2; min-width: 0; }
  main tbody td input, #edit-modal tbody td input { width: 100%; }
  main tbody td[colspan], #edit-modal tbody td[colspan] { display: block; }
  main tbody td[colspan]::before { display: none; }
  [id$='-modal'].fixed { padding: 0; align-items: stretch; z-index: 60; }
  [id$='-modal'].fixed > div { max-width: none; max-height: 100dvh; height: 100dvh; border-radius: 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); overflow-y: auto; }
  #add-inventory-form > div:last-child, #edit-modal > div > div:last-child { position: sticky; bottom: 0; z-index: 5; background: white; padding: .75rem 0; }
  button[onclick='checkoutCart()'] { position: sticky; bottom: calc(4.75rem + env(safe-area-inset-bottom)); z-index: 10; }
  #toast { bottom: calc(5rem + env(safe-area-inset-bottom)); width: max-content; }
  #cloud-toolbar { left: .75rem; right: .75rem; justify-content: space-between; }
  .management-row { align-items: flex-start; }
}
@media print { #cloud-toolbar, #toast, #login-overlay, #import-modal { display: none !important; } }
.mobile-sort { display: none; }
@media screen and (max-width: 767px) { .mobile-sort { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; } }
@media screen and (max-width: 767px) { button { min-width: 44px; } }

.mobile-label { display: none; }
@media screen and (max-width: 767px) {
  aside .desktop-label { display: none; }
  aside .mobile-label { display: inline; }
  aside nav .nav-btn { font-size: 11px; }
}
