/* Vitrin application surfaces. Shared theme tokens keep all four themes aligned. */
:root {
  --app-ease: cubic-bezier(.22, 1, .36, 1);
  --app-glass: color-mix(in srgb, var(--surface) 92%, transparent);
  --app-accent: var(--nav-active-icon);
  --app-nav-height: 76px;
}
.app-shell { grid-template-rows: 60px auto minmax(0, 1fr); }
.app-announcement { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.app-announcement:empty { display: none; }
.app-announcement .announcement-panel { min-height: 34px; max-width: none; border-radius: 0; border-width: 0 0 1px; padding: 6px 20px; }
.app-shell > .sidebar, .app-shell > .main { grid-row: 3; }
.topbar { grid-template-columns: minmax(0, 1fr) auto; }
.stock-selected-toolbar { flex-wrap: wrap; }
.stock-selected-toolbar > span { min-width: 0; overflow-wrap: anywhere; }
.stock-selected-toolbar .detail-actions { min-width: 0; flex-wrap: wrap; }
.mobile-header-actions { display: flex; align-items: center; flex: 0 0 auto; }
.notification-trigger { position: relative; width: 44px; height: 44px; }
.notification-dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--app-accent); box-shadow: 0 0 0 3px var(--surface); }
[hidden] { display: none !important; }
.btn, .icon-btn { -webkit-tap-highlight-color: transparent; transition: transform .16s var(--app-ease), background .18s, opacity .18s; }
.btn:active:not(:disabled), .icon-btn:active:not(:disabled) { transform: scale(.97); }
button:disabled { cursor: not-allowed; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.form-chapters { display: none; }
.main.content-refresh > section { animation: none; }
.main h1:focus { outline: none; }
.record-search-tools { margin-bottom: 16px; }
.record-search-tools .search-wrap { max-width: 600px; }

/* Shared device search and camera action. The input node is retained while filtering. */
.device-search-wrap, .global-search { position: relative; }
.device-search-wrap .filter-input, .global-search input { padding-right: 60px; }
.device-search-wrap .search-scan-button, .global-search .search-scan-button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 44px; min-height: 38px; border: 0; color: var(--cyan); background: var(--cyan-soft); border-radius: 10px; }
.search-scan-button svg { position: static; width: 20px; height: 20px; }
.imei-row .search-scan-button { flex: 0 0 42px; min-height: 44px; color: var(--cyan); background: var(--cyan-soft); }
.imei-row { display: flex; gap: 6px; min-width: 0; }
.imei-row .imei-primary { flex: 1 1 0; min-width: 0; }
.imei-row .imei-check-control { flex: 0 0 48px; min-width: 48px; }
.imei-row .imei-check-digit { width: 48px; min-width: 48px; min-height: 44px; }
.imei-row .icon-btn { flex-shrink: 0; }
.global-results[hidden] { display: none; }

/* Compact, reusable converter: one amount and two currency selectors. */
.modal.converter-modal { width: min(100%, 470px); }
.compact-converter { display: grid; gap: 18px; }
.converter-rates { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--green); font-size: .875rem; font-weight: 700; line-height: 1.6; }
.converter-rates .icon-btn { flex: 0 0 40px; }
.converter-rates .rate-unavailable { color: var(--muted); }
.converter-amount { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; }
.converter-pair { display: grid; grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr); gap: 8px; align-items: end; }
.converter-pair .field { min-width: 0; }
.converter-pair select, .converter-amount input { width: 100%; min-width: 0; min-height: 46px; font-size: 1rem; }
.converter-swap { margin-bottom: 2px; min-height: 42px; }
.converter-result { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.converter-result span { color: var(--muted); font-size: .875rem; }
.converter-result output { color: var(--ink); font-size: clamp(1.15rem, 4vw, 1.5rem); font-weight: 800; overflow-wrap: anywhere; }
#converter-hint { margin: 0; color: var(--muted); font-size: .8125rem; line-height: 1.6; }

.scanner-backdrop { position: fixed; inset: auto 0; top: var(--app-viewport-top, 0); height: var(--app-viewport-height, 100dvh); z-index: 1600; background: rgb(0 0 0 / .62); display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overscroll-behavior: contain; }
body:has(#barcode-scan-layer) { overflow: hidden; }
.scanner-dialog { width: min(100%, 500px); max-height: calc(var(--app-viewport-height, 100dvh) - 28px); overflow: auto; display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; color: var(--ink); box-shadow: var(--shadow); }
.scanner-dialog header { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.scanner-dialog header h2 { margin: 0; font-size: 1.2rem; }
.scanner-dialog header p, .scanner-dialog small { color: var(--muted); line-height: 1.6; font-size: .8125rem; margin: 6px 0 0; }
.scanner-dialog header .icon-btn { flex-shrink: 0; }
.scanner-video { position: relative; background: #05070b; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; }
.scanner-video video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 23% 8%; border: 2px solid #71e7ef; border-radius: 12px; box-shadow: 0 0 0 120px rgb(0 0 0 / .22); pointer-events: none; }
.scanner-dialog [data-scan-status] { margin: 0; color: var(--ink); line-height: 1.6; font-size: .875rem; }
.scanner-manual { display: flex; gap: 8px; align-items: end; min-width: 0; }
.scanner-manual .field { flex: 1; min-width: 0; }
.scanner-manual input { width: 100%; min-width: 0; font-size: 16px; }
.scanner-dialog footer { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 14px; }
.scanner-dialog footer .btn { flex: 1; }
@media (max-width: 720px) {
  .modal.converter-modal { height: auto; max-height: calc(var(--app-viewport-height, 100dvh) - 24px); border-radius: 24px 24px 0 0; }
  .device-search-wrap .filter-input { padding-right: 60px; }
  .scanner-dialog { padding: 16px; }
}
.record-search-empty { padding: 16px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.search-wrap > svg.lucide, .global-search > svg.lucide { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.modal-backdrop { animation: app-scrim-in .22s ease both; }
.modal-backdrop > .modal { animation: app-dialog-in .28s var(--app-ease) both; }
.modal, .modal-head, .modal-footer { background: var(--surface); }
.modal-head h2 { overflow-wrap: anywhere; line-height: 1.4; }
.modal-head .icon-btn { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); }
.modal-head h2:focus { outline: none; }
.sheet-leaving { pointer-events: none; animation: app-scrim-in .18s ease reverse both; }
.sheet-leaving > .modal { animation: app-dialog-in .18s ease reverse both; }
body.app-modal-open { overflow: hidden; }
.app-modal-open .main { pointer-events: none; }
.app-sheet { max-width: 520px; }
.app-sheet .modal-body { padding-top: 10px; }
.sheet-intro { margin: 4px 0 18px; color: var(--muted); font-size: .9375rem; line-height: 1.5; }
.sheet-section-title { font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .065em; text-transform: uppercase; margin: 22px 2px 10px; }
.command-list { border: 1px solid var(--line); background: var(--surface-2); border-radius: 18px; overflow: hidden; }
.mobile-command { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 14px; border: 0; background: transparent; min-height: 76px; transition: background .18s, transform .16s; }
.mobile-command + .mobile-command { border-top: 1px solid var(--line); }
.mobile-command > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; flex: 1; }
.mobile-command b { font-size: .9375rem; line-height: 1.3; color: var(--ink); }
.mobile-command small { color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.mobile-command > svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.command-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--cyan); }
.command-icon svg { width: 21px; height: 21px; stroke-width: 1.7; }
.command-primary .command-icon { color: var(--app-accent); border-color: var(--nav-active-border); background: var(--nav-active-bg); }
.mobile-command:hover { background: var(--row-hover-bg); }
.mobile-command:active { background: var(--row-selected-bg); }
.quick-cash-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-cash-actions .btn { min-height: 50px; }
.workspace-identity { display: flex; align-items: center; gap: 12px; padding: 10px 0 16px; border-bottom: 1px solid var(--line); }
.workspace-avatar { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; color: var(--app-accent); background: var(--nav-active-bg); border: 1px solid var(--nav-active-border); border-radius: 15px; }
.workspace-identity > div { display: grid; gap: 5px; min-width: 0; }
.workspace-identity b { font-size: 1rem; overflow-wrap: anywhere; }
.workspace-identity small { color: var(--muted); overflow-wrap: anywhere; }
.install-entry { margin-top: 20px; border: 1px solid var(--line); border-radius: 18px; }
.menu-signout { margin-top: 14px; min-height: 48px; }
.connection-card { display: flex; gap: 12px; align-items: center; padding: 15px; margin: 8px 0 16px; border-radius: 16px; background: color-mix(in srgb, var(--green) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line)); }
.connection-card > svg { flex-shrink: 0; color: var(--green); }
.connection-card > div { display: grid; gap: 5px; }
.connection-card b { font-size: .9375rem; }
.connection-card span { color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.connection-card.offline { background: var(--surface-2); }
.connection-card.offline > svg { color: var(--amber); }
.announcement-notice { display: flex; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; }
.announcement-notice > svg { flex: 0 0 22px; color: var(--app-accent); }
.announcement-notice b { font-size: .875rem; }
.announcement-notice p { margin: 7px 0 0; font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; color: var(--muted); }
.notification-item { display: flex; gap: 12px; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.notice-icon { flex: 0 0 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--green); }
.notice-icon svg { width: 18px; }
.notification-item.error .notice-icon { color: var(--coral); }
.notification-item p { margin: 0 0 6px; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.notification-item time { font-size: .75rem; color: var(--muted); }
.app-empty { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 38px 20px; }
.app-empty > svg { width: 32px; height: 32px; color: var(--muted); stroke-width: 1.5; }
.app-empty b { font-size: 1rem; }
.app-empty p { font-size: .875rem; color: var(--muted); line-height: 1.6; margin: 0; max-width: 280px; }
#toast-root { position: fixed; z-index: 100; right: max(18px, env(safe-area-inset-right)); top: max(18px, env(safe-area-inset-top)); width: min(390px, calc(100vw - 32px)); display: grid; gap: 10px; pointer-events: none; }
#toast-root .toast { position: relative; inset: auto; max-width: none; display: flex; gap: 12px; align-items: center; width: 100%; padding: 14px 10px 14px 15px; color: var(--ink); background: var(--app-glass); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 32px rgba(0,0,0,.18); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); pointer-events: auto; overflow: hidden; animation: app-toast-in .3s var(--app-ease) both; }
.toast-icon { display: grid; place-items: center; flex: 0 0 32px; color: var(--green); }
.toast.error .toast-icon { color: var(--coral); }
.toast-content { display: grid; gap: 4px; min-width: 0; flex: 1; }
.toast-content b { font-size: .75rem; letter-spacing: .02em; }
.toast-content span { font-size: .875rem; line-height: 1.45; overflow-wrap: anywhere; }
.toast .icon-btn { width: 40px; height: 40px; flex-shrink: 0; color: var(--muted); }
.toast-lifetime { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--green); opacity: .4; transform-origin: left; animation: app-toast-life 5.5s linear forwards; }
.toast.error .toast-lifetime { background: var(--coral); animation-duration: 10s; }
.toast:hover .toast-lifetime, .toast:focus-within .toast-lifetime { animation-play-state: paused; }
#toast-root .toast-leaving { animation: app-toast-in .18s ease reverse both; }
.app-confirm-layer { position: fixed; z-index: 110; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.52); backdrop-filter: blur(6px); animation: app-scrim-in .18s ease both; }
.app-confirm { width: min(100%, 380px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 24px; padding: 24px; box-shadow: var(--shadow); animation: app-dialog-in .25s var(--app-ease) both; }
.confirm-icon { display: grid; place-items: center; height: 48px; width: 48px; border-radius: 15px; background: var(--nav-active-bg); color: var(--app-accent); }
.app-confirm h2 { margin: 18px 0 8px; font-size: 1.125rem; line-height: 1.4; }
.app-confirm p { color: var(--muted); font-size: .9375rem; line-height: 1.6; margin: 0 0 24px; }
.confirm-actions { display: flex; flex-direction: column-reverse; gap: 8px; }
.confirm-actions .btn { width: 100%; min-height: 48px; }
.btn-danger { color: var(--coral); }
html[data-theme="light"] .btn:where(:not(.btn-secondary, .btn-danger, .btn-quiet)) { background: #117b9b; color: #fff; }
html[data-theme="light"] .finance-actions .btn { background: var(--surface); color: var(--ink); }
html[data-theme="light"] .amount-expense, html[data-theme="light"] .badge.sold, html[data-theme="light"] .imei-status.invalid { color: #b83449; }
html[data-theme="light"] .badge.stock { color: #106c48; }
html[data-theme="light"] .badge.purchase { color: #10667e; }
html[data-theme="light"] .badge.warning { color: #865500; }
html[data-theme="light"] .profit-donut { background: conic-gradient(var(--green) var(--donut, 0%), #e5ebf2 0); box-shadow: inset 0 0 0 15px var(--surface); }
.form-error { color: var(--coral); }
.install-guide { display: grid; justify-items: center; text-align: center; padding: 20px 8px; }
.install-guide-icon { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 23px; color: var(--app-accent); background: var(--nav-active-bg); border: 1px solid var(--nav-active-border); }
.install-guide-icon svg { width: 34px; height: 34px; }
.install-guide h3 { margin: 22px 0 12px; font-size: 1.2rem; }
.install-guide p { line-height: 1.7; font-size: .9375rem; color: var(--muted); }
.install-guide .install-note { font-size: .8125rem; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.mobile-stock-menu.stock-context-menu { display: grid; position: static; width: 100%; max-height: none; box-shadow: none; border: 0; background: transparent; padding: 0; }
.mobile-stock-menu button { min-height: 48px; white-space: normal; text-align: left; border-radius: 12px; font-size: .9375rem; }
.mobile-stock-menu hr { width: 100%; }
@keyframes app-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-dialog-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes app-sheet-in { from { transform: translateY(64px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes app-toast-in { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes app-toast-life { to { transform: scaleX(0); } }
@keyframes app-page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (min-width: 721px) and (max-width: 1100px) {
  .app-shell, .app-shell.sidebar-collapsed { grid-template-columns: 96px minmax(0, 1fr); }
  .sidebar .brand-meta, .sidebar .brand-text, .sidebar .nav-button span, .sidebar .sidebar-footer { display: none; }
  .sidebar .sidebar-brand-main, .sidebar .sidebar-brand-top { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar .nav-button { justify-content: center; min-height: 48px; padding: 12px; }
  .main { padding: 24px 20px; }
  .topbar { grid-template-columns: minmax(0,1fr); }
  .header-actions { min-width: 0; width: 100%; }
  .global-search { min-width: 0; }
  .stock-selected-toolbar { display: grid; gap: 10px; }
  .stock-selected-toolbar .detail-actions { margin: 0; }
  .label-workbench { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 720px) {
  :root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --scrollbar-size: 6px; }
  html { scrollbar-gutter: auto; overflow-x: clip; }
  body { padding-bottom: 0; scrollbar-gutter: auto; overflow-x: clip; }
  body.app-modal-open { position: fixed; top: var(--locked-scroll-y, 0); left: 0; right: 0; width: 100%; }
  .app-shell { min-height: 100svh; background: var(--canvas); }
  .app-titlebar { min-height: calc(66px + env(safe-area-inset-top)); padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: var(--app-glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); gap: 8px; }
  .app-title-left { justify-content: flex-start; width: auto; flex: 1; gap: 12px; }
  .titlebar-brand { gap: 7px; }
  .titlebar-brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .titlebar-brand b { font-size: 1.2rem; }
  .titlebar-brand span { font-size: .625rem; letter-spacing: .11em; }
  .app-title-left .currency-panel { border: 0; padding: 5px 0; margin-left: auto; font-size: .75rem; gap: 4px; min-height: 44px; }
  .app-title-left .currency-panel svg { width: 16px; height: 16px; }
  .app-announcement .announcement-panel { padding: 8px 16px; min-height: 34px; gap: 8px; background: var(--nav-active-bg); border-color: var(--line); }
  .app-announcement .announcement-panel span { font-size: .75rem; }
  .app-announcement .announcement-panel svg { width: 15px; height: 15px; flex: 0 0 15px; }
  .main { scrollbar-gutter: auto; padding: 22px max(16px, env(safe-area-inset-right)) calc(var(--app-nav-reserved, var(--app-nav-height)) + env(safe-area-inset-bottom) + 32px) max(16px, env(safe-area-inset-left)); }
  .main > section { animation: app-page-in .3s var(--app-ease) both; }
  .topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 20px; }
  .topbar .title-block { flex: 1; min-width: 0; }
  .topbar .eyebrow { font-size: .75rem; letter-spacing: .02em; line-height: 1.5; margin-bottom: 5px; color: var(--muted); }
  .topbar h1 { font-size: clamp(1.45rem, 5.8vw, 1.9rem); line-height: 1.18; letter-spacing: -.035em; overflow-wrap: anywhere; }
  .header-actions { min-width: 0; gap: 0; flex: 0 0 auto; }
  .header-actions > .btn, .header-actions > .sync-chip, .header-actions > .global-search { display: none; }
  .header-actions > .icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
  .panel-card, .summary-card { background: var(--surface); border-color: var(--line); border-radius: 20px; padding: 18px; box-shadow: 0 3px 14px rgba(0,0,0,.025); }
  .panel-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .panel-head h2 { font-size: 1rem; line-height: 1.4; }
  .panel-head small { font-size: .8125rem; line-height: 1.5; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .summary-card { min-height: 126px; padding: 16px; }
  .summary-card::after { display: none; }
  .summary-card .card-label { font-size: .8125rem; font-weight: 600; color: var(--muted); }
  .summary-card .card-value { font-size: clamp(1rem, 4.8vw, 1.5rem); letter-spacing: -.045em; line-height: 1.3; margin-top: 10px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .summary-card .card-note { display: block; font-size: .75rem; line-height: 1.4; margin-top: 7px; color: var(--muted); }
  .finance-summary-card:first-child { border-color: var(--nav-active-border); background: linear-gradient(135deg, var(--nav-active-bg), transparent), var(--surface); }
  .finance-toolbar { display: flex; gap: 12px; margin-bottom: 18px; }
  .finance-actions { order: 3; display: flex; gap: 10px; }
  .finance-actions .btn { min-height: 44px; font-size: .875rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
  .finance-actions .btn svg { color: var(--green); }
  .finance-actions .btn:last-child svg { color: var(--coral); }
  .finance-search { order: 1; }
  .period-toggle { order: 2; flex-wrap: nowrap; overflow-x: auto; padding: 5px; border-radius: 14px; background: var(--surface); scrollbar-width: none; }
  .period-toggle button { flex: 0 0 auto; min-height: 40px; padding: 8px 14px; font-size: .8125rem; white-space: nowrap; border-radius: 10px; }
  .period-toggle button.active { background: var(--surface-2); color: var(--ink); }
  .finance-grid { gap: 14px; margin-top: 14px; }
  .profit-card { grid-template-columns: 1fr; gap: 22px; }
  .profit-lines > div { min-height: 36px; }
  .profit-lines span { font-size: .8125rem; }
  .profit-lines b { font-size: .875rem; }
  .finance-tabs { border-radius: 14px; padding: 5px; margin-bottom: 16px; }
  .finance-tabs button { min-height: 44px; font-size: .875rem; }
  .finance-tabs button.active { background: var(--cyan-soft); color: var(--cyan); }
  .field input, .field select, .field textarea, .filter-input, .global-search input { font-size: 16px; min-height: 50px; line-height: 1.5; padding: 12px 14px; background: var(--surface-2); border-radius: 14px; }
  .field > span { font-size: .875rem; line-height: 1.5; }
  .field { margin-bottom: 18px; min-width: 0; }
  .field textarea { min-height: 100px; }
  .field input, .field select { scroll-margin: 90px 0; }
  .search-wrap { min-width: 0; width: 100%; }
  .search-wrap .filter-input { width: 100%; padding-left: 42px; background: var(--surface); border-radius: 16px; min-height: 52px; }
  .btn { min-height: 48px; border-radius: 14px; font-size: .9375rem; line-height: 1.35; }
  .icon-btn { width: 44px; height: 44px; }
  .page-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .page-tools > .search-wrap { grid-column: 1 / -1; }
  .page-tools .filter-input { min-width: 0; width: 100%; font-size: .875rem; }
  .page-tools .btn { width: 100%; font-size: .875rem; min-width: 0; }
  .page-tools > .column-popover { min-width: 0; }
  .column-menu { max-width: calc(100vw - 32px); width: 280px; }
  .stock-selected-toolbar { padding: 12px; border-radius: 16px; }
  body[data-ui-page="stock"] .stock-selected-toolbar, body[data-ui-page="stock"] .page-tools > .column-popover { display: none; }
  body[data-ui-page="stock"] .page-tools > .btn { grid-column: 1 / -1; }
  .stock-selected-toolbar .detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stock-selected-toolbar .btn { font-size: .8125rem; }
  .mobile-list { gap: 12px; }
  .mobile-device { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); overflow: hidden; }
  .mobile-device summary { display: grid; grid-template-columns: 42px minmax(0, 1fr) 20px; gap: 12px; align-items: center; padding: 17px; list-style: none; min-height: 108px; }
  .mobile-device summary::-webkit-details-marker { display: none; }
  .mobile-device-avatar { width: 42px; height: 48px; display: grid; place-items: center; border-radius: 13px; color: var(--cyan); background: var(--cyan-soft); border: 1px solid var(--line); }
  .mobile-device-avatar svg { width: 23px; height: 23px; stroke-width: 1.6; }
  .mobile-device-info { gap: 6px; min-width: 0; }
  .mobile-device-info b { font-size: 1rem; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
  .mobile-device-info > span { font-size: .8125rem; color: var(--muted); white-space: normal; line-height: 1.5; }
  .mobile-device-info .mobile-device-price { font-size: 1rem; margin-top: 3px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .mobile-device-chevron { color: var(--muted); width: 18px; transition: transform .2s var(--app-ease); }
  .mobile-device[open] .mobile-device-chevron { transform: rotate(180deg); }
  .mobile-details { padding: 0 17px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .mobile-details > div { min-width: 0; }
  .mobile-details b { overflow-wrap: anywhere; font-size: .875rem; }
  .mobile-details span { font-size: .75rem; }
  .mobile-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) 44px; padding: 14px 17px; gap: 8px; background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); border-top: 1px solid var(--line); }
  .mobile-actions .btn { min-height: 46px; font-size: .875rem; }
  .mobile-device.selected { background: var(--surface); border-color: var(--row-selected-line); }
  .mobile-device.selected summary { background: var(--row-selected-idle-bg); }
  .adaptive-table-wrap { overflow: visible; background: transparent; border: 0; padding: 0; box-shadow: none; }
  .adaptive-table { display: block; min-width: 0 !important; width: 100%; }
  .adaptive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .adaptive-table tbody { display: grid; gap: 12px; width: 100%; }
  .adaptive-table tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); min-width: 0; }
  .adaptive-table td { display: block; min-width: 0; white-space: normal; padding: 9px 0; border: 0; line-height: 1.5; font-size: .875rem; overflow-wrap: anywhere; }
  .adaptive-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; font-size: .75rem; font-weight: 500; color: var(--muted); }
  .adaptive-table td.adaptive-title { grid-column: 1 / -1; order: -1; padding-top: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
  .adaptive-table td.adaptive-title::before { display: none; }
  .adaptive-table .device-main b { font-size: .9375rem; line-height: 1.45; }
  .adaptive-table .device-main span { font-size: .8125rem; }
  .adaptive-table td.adaptive-actions { grid-column: 1 / -1; padding-bottom: 0; }
  .adaptive-table td.adaptive-actions::before { display: none; }
  .adaptive-table .row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .adaptive-table .icon-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
  .adaptive-table tr.selected { border-color: var(--row-selected-line); background: var(--row-selected-idle-bg); }
  .adaptive-table tr.selected:focus-within { background: var(--row-selected-bg); }
  .adaptive-table td[colspan] { grid-column: 1 / -1; }
  .adaptive-table td[colspan]::before { display: none; }
  .bottom-nav { z-index: 24; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); min-height: var(--app-nav-height); padding: 7px 5px; gap: 2px; border: 1px solid var(--line); border-radius: 25px; background: var(--app-glass); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 8px 32px rgba(0,0,0,.15), inset 0 1px 0 color-mix(in srgb, var(--ink) 5%, transparent); transition: opacity .2s, transform .2s var(--app-ease); }
  .bottom-nav button { min-width: 0; min-height: 60px; padding: 0 1px; display: grid; align-content: center; justify-items: center; gap: 4px; color: var(--muted); font-size: .75rem; line-height: 1.3; font-weight: 600; -webkit-tap-highlight-color: transparent; border-radius: 18px; }
  .bottom-nav .nav-icon { display: grid; place-items: center; width: 48px; max-width: 100%; height: 31px; border-radius: 12px; transition: background .2s, color .2s, transform .2s var(--app-ease); }
  .bottom-nav .nav-icon svg { width: 22px; height: 22px; stroke-width: 1.7; }
  .bottom-nav button > span:last-child { overflow-wrap: anywhere; }
  .bottom-nav button.active { color: var(--app-accent); }
  .bottom-nav button.active .nav-icon { background: var(--nav-active-bg); }
  .bottom-nav button:active .nav-icon { transform: scale(.9); }
  .bottom-nav .nav-create .nav-icon { color: #fff; background: var(--brand-coral-dark); height: 34px; width: 48px; border-radius: 12px; box-shadow: 0 4px 10px rgba(196,62,70,.18); }
  .bottom-nav .nav-create > span:last-child { color: var(--ink); }
  .keyboard-open .bottom-nav, .app-modal-open .bottom-nav { opacity: 0; pointer-events: none; transform: translateY(18px); }
  .modal-backdrop, .attachment-preview-layer { inset: auto 0; top: var(--app-viewport-top, 0); height: var(--app-viewport-height, 100dvh); padding: max(10px, env(safe-area-inset-top)) 0 0; display: flex; align-items: flex-end; justify-content: center; }
  .modal-backdrop > .modal, .attachment-preview-layer > .modal { width: 100%; max-width: none; max-height: 100%; border-radius: 28px 28px 0 0; border-bottom: 0; background: var(--surface); animation: app-sheet-in .34s var(--app-ease) both; }
  .modal-backdrop.sheet-leaving > .modal { animation: app-sheet-in .18s ease reverse both; }
  .modal.wide:has(#purchase-form) { height: 100%; }
  .modal-head { min-height: 80px; padding: 26px 20px 12px; border-bottom: 1px solid var(--line); gap: 12px; }
  .modal-head::before { content: ''; position: absolute; top: 10px; left: calc(50% - 18px); width: 36px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 35%, transparent); }
  .modal-head h2 { font-size: 1.125rem; letter-spacing: -.02em; }
  .modal-body { padding: 20px; scrollbar-gutter: auto; scroll-padding: 16px; }
  .modal:not(:has(.modal-footer)) .modal-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .modal-footer { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px color-mix(in srgb, var(--canvas) 35%, transparent); gap: 10px; }
  .keyboard-open .modal-footer { padding-bottom: 12px; }
  .modal-footer .btn { min-height: 50px; min-width: 0; }
  .modal-footer .btn-secondary { flex: 0 1 32%; }
  .modal-footer .btn:not(.btn-secondary) { flex: 1; }
  .form-chapters { display: flex; gap: 6px; flex: 0 0 auto; overflow-x: auto; padding: 10px 20px; border-bottom: 1px solid var(--line); scrollbar-width: none; background: var(--surface); }
  .form-chapters button { white-space: nowrap; min-height: 40px; border: 1px solid var(--line); padding: 8px 12px; border-radius: 12px; color: var(--muted); background: var(--surface-2); font-size: .8125rem; }
  .form-chapters button:focus { color: var(--cyan); border-color: var(--cyan); }
  .form-section { margin: 12px 0 20px; padding-top: 22px; font-size: .8125rem; color: var(--app-accent); }
  .form-grid > .form-section:first-child { border-top: 0; padding-top: 0; }
  .capacity-input, .money-input, .color-input, .phone-input { min-height: 50px; border-radius: 14px; background: var(--surface-2); }
  .capacity-input input, .capacity-input select, .money-input input, .money-input select, .color-input input, .phone-input input { min-height: 48px; border-radius: 0; font-size: 16px; }
  .capacity-input select, .money-input select { padding: 8px; }
  .color-swatch, .color-swatch.empty { padding: 0; min-height: 0; width: 22px; height: 22px; aspect-ratio: 1; }
  .field select, .filter-input:is(select) { appearance: none; -webkit-appearance: none; padding-right: 32px; background-color: var(--surface-2); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23929aa8' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
  .capacity-input select, .money-input select { padding-left: 8px; padding-right: 22px; background-position: right 6px center; }
  .inline-check { min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: .875rem; }
  .inline-check input, .check-field input { width: 20px; height: 20px; }
  .check-grid { gap: 8px; }
  .imei-status { min-height: 0; padding: 6px 0; border: 0; text-align: left; font-size: .75rem !important; }
  .official-status { font-size: .75rem !important; }
  .camera-panel { background: var(--cyan-soft); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
  .camera-panel .detail-actions .btn { flex: 1; }
  .detail-grid { border-radius: 16px; }
  .detail-field { padding: 14px; background: var(--surface); }
  .detail-field span { font-size: .75rem; line-height: 1.5; }
  .detail-field b { font-size: .875rem; line-height: 1.5; }
  .detail-actions { gap: 10px; }
  .attachment-manager { padding: 16px; border-radius: 18px; }
  .attachment-controls { display: flex; flex-wrap: wrap; gap: 8px; }
  .attachment-controls .btn { flex: 1 1 120px; font-size: .875rem; }
  .attachment-select { flex-basis: 100%; min-height: 48px; font-size: 16px; }
  .attachment-name, .attachment-title, .attachment-meta { overflow-wrap: anywhere; white-space: normal; }
  .qr-main-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .qr-main-btn { min-width: 0; font-size: .9375rem; }
  .qr-device-hero h3 { overflow-wrap: anywhere; }
  .login-shell { min-height: 100svh; padding: calc(28px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); background: radial-gradient(ellipse at 10% 0, var(--nav-active-bg), transparent 65%), var(--canvas); display: flex; align-items: center; justify-content: center; }
  .login-card { min-height: 0; width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
  .login-brand { padding: 26px 24px 22px; }
  .login-brand p { font-size: .875rem; line-height: 1.6; }
  .login-brand-text span { font-size: .875rem; }
  .login-brand-text strong { font-size: 2.2rem; }
  .login-form { padding: 24px; }
  .login-form > p { font-size: .875rem; line-height: 1.6; }
  .login-form .btn-full { min-height: 52px; }
  .login-actions { justify-content: space-between; gap: 12px; }
  .login-actions .link-button { min-height: 44px; font-size: .875rem; }
  .login-form .check-field { min-height: 44px; font-size: .875rem; }
  .pause-banner { z-index: 25; left: 16px; right: 16px; bottom: calc(var(--app-nav-reserved, var(--app-nav-height)) + env(safe-area-inset-bottom) + 20px); font-size: .8125rem; }
  .app-modal-open .pause-banner { display: none; }
  #toast-root { top: calc(env(safe-area-inset-top) + 12px); right: 12px; left: 12px; width: auto; }
  #toast-root .toast { border-radius: 20px; }
  .app-confirm-layer { top: var(--app-viewport-top, 0); height: var(--app-viewport-height, 100dvh); bottom: auto; }
  .report-toolbar, .report-filters { flex-wrap: wrap; }
  .report-toolbar > *, .report-filters > * { min-width: 0; max-width: 100%; }
}
@media (max-width: 360px) {
  .app-title-left { gap: 6px; }
  .app-title-left .currency-panel { font-size: .6875rem; }
  .titlebar-brand-mark { width: 28px; flex-basis: 28px; }
  .mobile-device summary { grid-template-columns: 34px minmax(0,1fr) 16px; gap: 9px; padding: 14px; }
  .mobile-device-avatar { width: 34px; }
  .modal-body, .modal-head, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .summary-card { padding: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .app-announcement, .mobile-header-actions, .form-chapters, #toast-root, .app-confirm-layer { display: none !important; }
  body.app-modal-open { position: static; overflow: visible; }
  .app-shell { display: block; }
  .adaptive-table { display: table; }
  .adaptive-table thead { position: static; width: auto; height: auto; clip-path: none; }
  .adaptive-table tbody { display: table-row-group; }
  .adaptive-table tbody > tr { display: table-row; }
  .adaptive-table td { display: table-cell; }
  .adaptive-table td::before { display: none; }
}
/* Success notices never obstruct the current form. Errors stay dismissible. */
#toast-root .toast:not(.error){pointer-events:none}
#toast-root .toast button{pointer-events:auto}
#toast-root .toast.error .toast-lifetime{display:none}
.label-settings-panel .label-setting-card{border:0;border-radius:0;box-shadow:none;background:transparent;padding:12px 0}
.label-settings-panel .label-setting-card.full{border-top:1px solid var(--line,#41454e)}
.label-settings-panel .field input,.label-settings-panel .field select{min-height:38px;padding:8px 10px;border-radius:7px}
.label-settings-panel .setting-check{border-radius:7px;padding:8px}
@media(min-width:360px) and (max-width:720px){.label-settings-panel .form-grid,.label-settings-panel .setting-check-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.label-settings-panel .field{min-width:0}.label-settings-panel .field span{font-size:12px}}
