@layer reset, app;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { min-width: 280px; min-height: 100%; }
  body { margin: 0; min-height: 100vh; }
  button, input, select, textarea { font: inherit; }
  button { color: inherit; }
  [hidden] { display: none !important; }
  a { color: inherit; }
  h1, h2, h3, p { margin: 0; }
  :focus-visible { outline: 3px solid #2b8a72; outline-offset: 3px; }
}

@layer app {
  :root {
    color-scheme: light;
    --bg: #f3f6f3;
    --surface: #fff;
    --ink: #152e27;
    --muted: #4e625a;
    --line: #d9e3dc;
    --primary: #11664e;
    --primary-dark: #0c503d;
    --control-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23506481' stroke-width='1.6'/%3E%3C/svg%3E");
    --nav-bg: #102f28;
    --nav-ink: #cbdbd3;
    --radius: 17px;
    --shadow: 0 4px 18px #173c2e09;
    font: 100%/1.55 "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
  }
  :root:lang(ar) { font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
  body { overflow-wrap: anywhere; }
  button, a { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  button:disabled { cursor: default; opacity: .61; }
  svg { flex: none; vertical-align: middle; }
  .skip-link { position: fixed; inset-block-start: 8px; inset-inline-start: 12px; z-index: 9; background: #fff; padding: 8px 14px; transform: translateY(-200%); }
  .skip-link:focus { transform: none; }
  .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .app-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; align-items: start; }
  .sidebar { background: var(--nav-bg); color: var(--nav-ink); position: sticky; top: 0; min-height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: auto; padding: 20px 12px 16px; overscroll-behavior: contain; z-index: 5; scrollbar-width: thin; }
  .brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; color: #fff; font: 740 1.12rem/1.2 "Segoe UI", system-ui, sans-serif; }
  .brand-mark { flex: none; width: 40px; height: 40px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg,#286b53,#194c3b); border: 1px solid #6a917f; border-radius: 12px; box-shadow: 0 3px 12px #082e2188; }
  .brand-mark:has(.instance-logo) { background: #fff; }
  .brand > bdi { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .instance-logo { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
  .instance-logo-trigger { width: 100%; height: 100%; border-radius: inherit; }
  .sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 3px 21px; padding: 0 6px 19px; border-block-end: 1px solid #ffffff25; }
  .drawer-close { display: none; align-items: center; justify-content: center; min-width: 44px; height: 44px; border: 1px solid #658374; border-radius: 10px; color: #fff; background: transparent; }
  .nav-scrim { position: fixed; inset: 0; z-index: 4; background: #0d211b76; }
  html:has(.sidebar-open, dialog[open]) { overflow: hidden; }
  @media (hover: hover) and (min-width: 936px) { html { scrollbar-gutter: stable; } }
  .sidebar .nav-section + .nav-section { margin-block-start: 18px; }
  .nav-search { display: flex; align-items: center; gap: 7px; margin: -5px 3px 16px; padding-inline: 10px; color: #c8d9cf; background: #ffffff0a; border: 1px solid #4d6b5f; border-radius: 9px; }
  .nav-search input[type=search] { width: 100%; min-height: 38px; padding: 5px 0; color: #fff; background: transparent; border: none; border-radius: 0; font-size: .88rem; }
  .nav-search input::placeholder { color: #c6d7cc; }
  .nav-search:focus-within { outline: 2px solid #eac77a; outline-offset: 2px; }
  .nav-search input:focus { outline: none; }
  .nav-empty { padding: 8px 12px; color: #e4f0e7; font-size: .9rem; }
  .nav-label { margin: 0 10px 7px; font-size: .72rem; font-weight: 700; color: #a9bfb4; letter-spacing: .075em; }
  :root:lang(ar) .nav-label { letter-spacing: 0; }
  .nav-link, .side-install { display: flex; align-items: center; text-decoration: none; gap: 11px; width: 100%; color: inherit; font-size: .9rem; min-height: 41px; padding: 8px 11px; border: 1px solid transparent; border-radius: 8px; text-align: start; transition: background .16s, color .16s; }
  .nav-link svg { color: #a9c5b7; }
  .nav-link:hover, .side-install:hover { background: #204235; color: #fff; }
  .nav-link[aria-current="page"] { color: #f3fbf4; font-weight: 650; background: #285644; border-color: #507664; border-inline-start: 3px solid #eac77a; }
  .nav-link[aria-current="page"] svg { color: #f5d18c; }
  .sidebar-foot { margin-block-start: auto; padding-block-start: 24px; }
  .developer-credit { display: inline-flex; align-items: center; gap: .65rem; max-width: 100%; min-height: 44px; margin-block-start: 1rem; padding-block: .3rem; color: var(--muted); text-decoration: none; font-size: .78rem; line-height: 1.4; }
  .developer-credit img { flex: none; width: 32px; height: 32px; background: #171b22; border-radius: 7px; padding: 4px; }
  .developer-credit span { min-width: 0; }
  .developer-credit bdi { white-space: nowrap; }
  .developer-credit b { color: var(--ink); }
  .developer-credit .developer-phone { display: block; width: fit-content; }
  .developer-credit:hover .developer-phone, .developer-credit:focus-visible .developer-phone { text-decoration: underline; }
  .sidebar .developer-credit { color: var(--nav-ink); }
  .sidebar .developer-credit b { color: #fff; }
  .side-install { background: transparent; border-color: #446557; color: #e1eee6; }
  .shell-column { min-width: 0; }
  .topbar { height: 66px; background: var(--surface); border-block-end: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-inline: clamp(19px, 3vw, 42px); position: sticky; top: 0; z-index: 3; }
  .topbar-start, .topbar-actions { display: flex; align-items: center; gap: 11px; min-width: 0; }
  .topbar-actions { flex: none; }
  .topbar-crumb { display: flex; align-items: center; flex: none; gap: 6px; color: var(--muted); font-weight: 600; font-size: .9rem; }
  .topbar-logo { display: grid; place-items: center; color: #22664e; }
  .topbar-logo:has(.instance-logo) { width: 26px; height: 26px; border-radius: 6px; }
  .scope-label { border-inline-start: 1px solid var(--line); margin-inline-start: 3px; padding-inline-start: 12px; overflow: hidden; min-width: 0; }
  .scope-label select { border: 0; color: var(--ink); background-color: transparent; font-weight: 650; font-size: .86rem; width: 100%; min-height: 36px; }
  .topbar-button { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 5px 9px; color: var(--ink); font-size: .83rem; font-weight: 680; }
  .topbar-button:hover { border-color: #9ab6a7; background: #f3f8f4; }
  .topbar-inbox { position: relative; text-decoration: none; min-width: 36px; }
  .topbar-inbox[aria-current="page"] { background: #ebf5ef; border-color: #9ab6a7; }
  .inbox-badge { position: absolute; inset-block-start: -5px; inset-inline-end: -5px; min-width: 16px; height: 16px; padding-inline: 3px; display: grid; place-items: center; border-radius: 12px; border: 1px solid #fff; color: white; background: #176049; font-size: .65rem; line-height: 1; }
  .language-select { flex: none; }
  .language-select select { min-height: 36px; padding: 4px 24px 4px 7px; max-width: 102px; font-size: .8rem; background: var(--surface) var(--control-chevron) no-repeat right 6px center; }
  [dir="rtl"] .language-select select { padding: 4px 7px 4px 24px; background-position: left 6px center; }
  .connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #168658; box-shadow: 0 0 0 3px #d8f5e8; }
  [data-online="false"] .connection-dot { background: #b56b12; box-shadow: 0 0 0 3px #f5e8d4; }
  .queue-badge { color: #674a0d; background: #fff1cc; border-radius: 12px; min-width: 20px; padding-inline: 4px; }
  .avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid #c8dccf; background: #e7f1e8; color: #24543d; border-radius: 50%; font-weight: 750; text-transform: uppercase; }
  .account-menu { position: relative; }
  .account-menu summary { list-style: none; cursor: pointer; border-radius: 50%; }
  .account-menu summary::-webkit-details-marker { display: none; }
  .account-content { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 10px); width: max-content; min-width: 175px; max-width: calc(100vw - 35px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px; box-shadow: 0 12px 35px #0f244225; z-index: 7; }
  .account-content p { color: var(--muted); font-size: .84rem; margin-block-end: 10px; }
  .nav-toggle { display: none; }
  .workspace-main { max-width: 1480px; margin-inline: auto; min-width: 0; padding: clamp(20px, 2.6vw, 38px); }
  .page-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 15px; margin-block-end: 21px; }
  .page-title { font-size: clamp(1.64rem, 3.4vw, 2.55rem); line-height: 1.2; letter-spacing: -.035em; font-weight: 740; }
  :root:lang(ar) .page-title, :root:lang(ar) .hero-title { letter-spacing: 0; }
  .page-header p, .muted { color: var(--muted); }
  .page-header p { margin-block-start: 6px; }
  .date-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; font-size: .84rem; white-space: nowrap; }
  .scan-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(275px, 1fr); gap: 17px; align-items: stretch; }
  .scan-primary { min-width: 0; display: flex; flex-direction: column; }
  .workspace-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
  .workspace-card h2, .section-title { font-size: 1.18rem; line-height: 1.35; font-weight: 730; }
  .card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-block-end: 13px; }
  .card-link { color: #125e46; font-weight: 670; font-size: .87rem; text-decoration: none; }
  .card-link:hover { text-decoration: underline; }
  .scan-card { --scan-inline-padding: clamp(16px, 2.5vw, 26px); container-type: inline-size; padding: 0; overflow: hidden; flex: 1; }
  .scan-hero { isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; min-height: 188px; padding: clamp(18px, 3vw, 28px) var(--scan-inline-padding); color: #fff; background: radial-gradient(ellipse at 85% 100%, #78965a4d, transparent 48%), linear-gradient(115deg, #123f35, #17654d 74%, #205e47); overflow: hidden; }
  .scan-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .26; background-image: radial-gradient(#b5d6c4 1px, transparent 1px); background-size: 17px 17px; mask-image: linear-gradient(90deg, transparent, #000); }
  [dir="rtl"] .scan-hero::after { mask-image: linear-gradient(270deg, transparent, #000); }
  .hero-content { flex: 1; min-width: 0; }
  .scan-hero .hero-title { font-size: clamp(1.32rem, 2.8vw, 2.05rem); letter-spacing: -.04em; font-weight: 720; line-height: 1.15; }
  .hero-content p { margin-block-start: 7px; color: #e3f3e8; font-size: .94rem; }
  .scan-hero-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.25rem), 1fr));
    grid-auto-rows: 1fr;
    max-inline-size: 22rem;
    gap: 10px;
    margin-block-start: 18px;
  }
  .scan-hero-actions .button {
    min-inline-size: 0;
    min-block-size: 46px;
    padding: 8px 9px;
    border-radius: 10px;
    color: #154d39;
    border-color: #fff;
    background: #fff;
  }
  .scan-hero-actions .button:hover { background: #eff7ee; }
  .scan-hero-actions .button-quiet { color: #fff; border-color: #ffffff83; background: #ffffff1a; }
  .scan-hero-actions .button-quiet:hover { border-color: #fff; background: #ffffff32; }
  .scan-hero-actions .button:focus-visible { outline-color: #ffe4a4; }
  .barcode-graphic { width: clamp(108px, 21%, 178px); min-width: 108px; height: 98px; margin-inline-end: 3%; display: grid; place-items: center; flex: none; position: relative; color: #eac77a; background: linear-gradient(currentColor,currentColor) left top / 22px 2px, linear-gradient(currentColor,currentColor) left top / 2px 22px, linear-gradient(currentColor,currentColor) right top / 22px 2px, linear-gradient(currentColor,currentColor) right top / 2px 22px, linear-gradient(currentColor,currentColor) left bottom / 22px 2px, linear-gradient(currentColor,currentColor) left bottom / 2px 22px, linear-gradient(currentColor,currentColor) right bottom / 22px 2px, linear-gradient(currentColor,currentColor) right bottom / 2px 22px; background-repeat: no-repeat; border-radius: 3px; }
  .barcode-graphic::before { content: ""; width: 72%; height: 49%; background: repeating-linear-gradient(90deg,#f6e5b7 0 3px,transparent 3px 7px,#efd18e 7px 8px,transparent 8px 11px,#f0f7f4 11px 16px,transparent 16px 19px,#ddbe7d 19px 21px,transparent 21px 26px); opacity: .88; }
  .barcode-graphic::after { content: ""; position: absolute; inset-inline: -5px; inset-block-start: 50%; height: 1.5px; background: #ffd483; box-shadow: 0 0 12px 3px #e6bd6291; animation: scanline 3.4s ease-in-out 2; }
  @keyframes scanline { 0%, 100% { transform: translateY(-18px); } 50% { transform: translateY(18px); } }
  @container (max-width: 31rem) {
    .scan-hero .barcode-graphic { display: none; }
  }
  .scan-entry { padding: 19px var(--scan-inline-padding); }
  .scan-entry label { display: block; font-size: .89rem; font-weight: 680; margin-block-end: 6px; }
  .scan-field { display: flex; gap: 8px; }
  .scan-input-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
  .scan-input-wrap svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: #547769; pointer-events: none; }
  .scan-input-wrap input { width: 100%; min-width: 0; padding-inline-start: 39px; }
  .scan-input-wrap input:not(:placeholder-shown) { direction: ltr; text-align: end; }
  [dir=ltr] .scan-input-wrap input:not(:placeholder-shown) { text-align: start; }
  .scan-hint { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .8rem; margin-block-start: 9px; }
  .scan-hint kbd { direction: ltr; font: inherit; border: 1px solid var(--line); border-radius: 5px; padding-inline: 5px; white-space: nowrap; }
  .scan-section { margin-block-start: 18px; }
  .scan-section .section-title { margin-block-end: 10px; }
  .scanned-actions { margin-block-end: 11px; }
  .action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
  .quick-action { text-align: start; display: flex; gap: 10px; align-items: center; font-size: .95rem; font-weight: 680; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 13px 11px; min-height: 65px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s, background .15s; }
  .quick-action:hover { transform: translateY(-2px); background: #f5f9f5; border-color: #a5c3b0; }
  .action-icon { width: 34px; height: 34px; border-radius: 9px; background: #e7f1e9; color: #23674f; display: grid; place-items: center; flex: none; }
  .action-icon.receipt { background: #e3f5ed; color: #067249; }
  .action-icon.dispatch { background: #fff0df; color: #8d3c02; }
  .action-icon.transfer { background: #e8efff; color: #2857c6; }
  .action-icon.reservation { background: #f0e9ff; color: #60419d; }
  .action-icon.damage { background: #ffe9e5; color: #a33b30; }
  .activity-card { display: flex; flex-direction: column; min-height: 275px; }
  .scan-grid:has(#scan-result:not(:empty)) .activity-card { align-self: start; }
  .activity-list, .warehouse-list { list-style: none; padding: 0; margin: 0; }
  .activity-list li { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 9px; align-items: center; border-block-end: 1px solid var(--line); padding-block: 10px; }
  .activity-list li:last-child { border-block-end: 0; }
  .activity-list strong, .warehouse-list strong { display: block; font-size: .9rem; font-weight: 690; line-height: 1.3; }
  .activity-list small, .warehouse-list small { color: var(--muted); font-size: .78rem; }
  .activity-value { text-align: end; font-variant-numeric: tabular-nums; }
  .warehouse-list { display: grid; gap: 10px; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .warehouse-list li > a { padding: 10px; border-radius: 9px; border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; text-decoration: none; }
  .warehouse-list a:hover { border-color: #9db7a6; }
  .empty-state { color: var(--muted); padding: 16px 0; }
  .activity-card .empty-state { margin: auto; padding-inline: 12px; text-align: center; }
  .scanned-header { display: flex; gap: 11px; align-items: center; margin-block-end: 14px; }
  .scanned-header .action-icon { width: 43px; height: 43px; }
  .scanned-header h2 { font-size: 1.3rem; }
  .scanned-header > .button { margin-inline-start: auto; }
  .balance-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-block: 10px 15px; }
  .balance-strip div { background: #edf5ef; border: 1px solid #dbe8dd; padding: 11px; border-radius: 10px; }
  .balance-strip span { display: block; font-size: .8rem; color: var(--muted); }
  .balance-strip strong { display: block; font-size: 1.3rem; font-weight: 740; font-variant-numeric: tabular-nums; }
  .balance-strip dd { margin: 0; }
  .scan-state { margin-block-start: 10px; }
  .scan-state:empty { display: none; }
  .scan-context { display: flex; gap: 7px; align-items: center; margin-block-end: 11px; font-size: .88rem; flex-wrap: wrap; }
  .queue-list { display: grid; gap: 8px; margin-block: 12px; }
  .queue-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px; flex-wrap: wrap; }
  .queue-row .muted { font-size: .84rem; }

  .button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 42px; padding: 8px 13px; border-radius: 9px; border: 1px solid #ceded2; background: var(--surface); color: #265641; font-weight: 660; font-size: .9rem; line-height: 1.35; text-align: center; text-decoration: none; transition: border-color .14s, background .14s; }
  .button:hover { background: #edf5ef; border-color: #a4bfac; }
  .button-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  .button-primary:hover { color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); }
  .button-quiet { color: #125e46; background: #eaf4ed; border-color: transparent; }
  .button-danger { color: #9b2d23; background: #fff4f1; border-color: #f3cfc7; }
  .icon-button { width: 38px; min-width: 38px; padding: 0; }
  .button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  input:not([type="checkbox"],[type="radio"]), select, textarea { color: var(--ink); background-color: #fff; border: 1px solid #a7b9ad; border-radius: 8px; min-height: 43px; min-width: 0; padding: 7px 11px; }
  input::placeholder, textarea::placeholder { color: #5b6c61; opacity: 1; font-weight: 400; }
  :is(input, textarea)[dir="ltr"]:lang(ar):placeholder-shown { direction: rtl; text-align: start; }
  input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; }
  select { appearance: none; padding-inline-end: 35px; background-image: var(--control-chevron); background-repeat: no-repeat; background-position: right 11px center; }
  [dir="rtl"] select { background-position: left 11px center; }
  .scan-input-wrap input#scan-code { padding-inline-start: 39px; }
  [dir="rtl"] .scan-input-wrap input#scan-code { padding-right: 39px; padding-left: 11px; }
  .scope-label select { background-position: right 3px center; padding-inline: 1px 19px; }
  [dir="rtl"] .scope-label select { background-position: left 3px center; }
  .form-grid, .split-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .form-grid { margin-block: 13px; }
  .field { display: grid; gap: 4px; align-content: start; min-width: 0; font-size: .9rem; font-weight: 640; }
  .field-hint, .section-hint { display: block; color: var(--muted); font-size: .83rem; line-height: 1.5; font-weight: 400; }
  .section-hint { margin-block: .4rem .85rem; }
  .quick-action .field-hint { margin-block-start: .22rem; }
  .field small { font-weight: 400; color: var(--muted); }
  .mail-connection { padding: 0; border: 0; min-inline-size: 0; }
  .field-wide { grid-column: 1 / -1; }
  .checkbox-line { display: flex; gap: 6px; align-items: center; }
  .field-error { color: #942c24; font-size: .88rem; }
  .filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-block-end: 14px; }
  .filters .field { flex: 1 1 140px; }
  .table-wrap { overflow-x: auto; scrollbar-width: thin; max-width: 100%; }
  .data-table { border-collapse: collapse; width: 100%; text-align: start; font-size: .9rem; }
  .data-table th, .data-table td { text-align: start; padding: 10px 8px; border-block-end: 1px solid var(--line); }
  .data-table th { color: var(--muted); font-weight: 650; background: #edf3ee; }
  .chip { display: inline-flex; align-items: center; gap: 5px; background: #e9f2ec; color: #285840; border: 1px solid #d5e5d9; font-size: .79rem; font-weight: 680; border-radius: 30px; padding: 3px 8px; }
  .chip-warning { background: #fff4df; border-color: #f8e6bd; color: #805002; }
  .chip-success { background: #e2f6ec; border-color: #d1eddc; color: #086743; }
  .notice { border: 1px solid #cdddd2; color: #264f3e; background: #f0f7f4; padding: 10px 13px; border-radius: 9px; font-size: .9rem; }
  .notice.error { border-color: #f2c6bf; color: #922820; background: #fff2ef; }
  .notice.warning { border-color: #f7e0a9; color: #7c4d00; background: #fff6e2; }
  .notice.success { border-color: #c6ebd8; color: #0d643f; background: #eefaf3; }
  .dialog-panel { border: 1px solid var(--line); border-radius: 17px; width: min(560px, calc(100% - 26px)); max-height: calc(100dvh - 26px); overscroll-behavior: contain; margin: auto; max-width: none; padding: clamp(14px,3vw,24px); color: var(--ink); background: var(--surface); box-shadow: 0 18px 80px #07193640; }
  .dialog-panel::backdrop { background: #0e261cc2; }
  .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-end: 12px; }
  .dialog-head h2 { font-size: 1.25rem; line-height: 1.4; }
  .camera-window { background: #0e1929; border-radius: 12px; overflow: hidden; position: relative; min-height: 145px; margin-block: 12px; }
  .camera-window video { width: 100%; aspect-ratio: 4 / 3; max-height: 54dvh; display: block; object-fit: contain; }
  .camera-window::after { content: ""; position: absolute; inset: 24% 16%; border: 2px solid #78fddd; border-radius: 11px; pointer-events: none; box-shadow: 0 0 0 120px #102f2829; }
  .announcements { position: fixed; inset-inline-end: 16px; inset-block-end: 16px; width: min(390px,calc(100% - 32px)); display: grid; gap: 6px; z-index: 8; pointer-events: none; }
  .announcements p { box-shadow: 0 12px 28px #0a23372a; }
  .auth-layout { display: grid; min-height: 100vh; min-height: 100dvh; grid-template-columns: minmax(280px, 2fr) minmax(360px, 3fr); }
  .auth-aside { background: radial-gradient(ellipse at 90% 90%, #265d45, #102f28 68%); color: white; display: flex; flex-direction: column; align-items: flex-start; gap: 32px; padding: clamp(24px,6vw,100px); }
  .auth-aside .brand { font-size: 1.8rem; }
  .auth-aside .barcode-graphic { margin: auto; width: min(55%,215px); height: 142px; }
  .auth-content { display: grid; align-content: center; padding: clamp(23px,5vw,68px); justify-items: center; position: relative; }
  .auth-language { position: absolute; inset-block-start: 20px; inset-inline-end: 20px; }
  .auth-card { width: min(100%, 30rem); padding: clamp(20px, 3vw, 36px); border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 48px #18372a0c; }
  .auth-card form { display: grid; gap: 12px; margin-block-start: 19px; }
  .auth-card .button-primary { width: 100%; }
  .auth-card > p { margin-block-start: 9px; color: var(--muted); }
  .auth-secret { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
  .admin-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; }
  .admin-grid .quick-action { min-height: 72px; }
  .admin-detail { margin-block-start: 14px; }
  .admin-workspace { container-type: inline-size; }
  .admin-picker { display: none; }
  .admin-grid .quick-action { align-items: flex-start; padding: 15px; }
  .admin-grid .quick-action[aria-pressed="true"] { border-color: #97b3a0; background: #e7f1e9; color: #164c38; }
  .admin-workspace.has-section .admin-picker { display: grid; max-width: 28rem; margin-block-end: 12px; scroll-margin-block-start: 7rem; }
  .admin-workspace.has-section .admin-grid { display: none; }
  #admin-panel { min-inline-size: 0; }
  .admin-workspace.has-section #admin-panel > :first-child { margin-block-start: 0; }
  @container (min-width: 56rem) {
    .admin-workspace.has-section .admin-picker { display: none; }
    .admin-workspace.has-section .admin-columns { display: grid; grid-template-columns: 12.5rem minmax(0,1fr); align-items: start; gap: 1rem; }
    .admin-workspace.has-section .admin-grid { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
    .admin-workspace.has-section .admin-grid .quick-action { align-items: center; min-height: 44px; padding: 6px; box-shadow: none; border-color: transparent; }
    .admin-workspace.has-section .admin-grid .quick-action[aria-pressed="true"] { border-color: #a6bfaf; }
    .admin-workspace.has-section .admin-grid .field-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .admin-workspace.has-section .admin-grid .action-icon { width: 28px; height: 28px; }
  }
  .route-loading, .route-error { display: grid; align-content: start; gap: 12px; justify-items: start; }
  .route-loading { color: var(--muted); padding-block: 16px; }
  .workspace-main:focus { outline: none; }
  .page-header > *, .button-row > *, .card-head > *, .quick-action > span:last-child { min-inline-size: 0; }
  .page-header p { max-inline-size: 76ch; line-height: 1.6; }
  .workspace-main > .workspace-card + .workspace-card { margin-block-start: 16px; }
  .field :is(input, textarea, select) { max-width: 100%; font-weight: 400; }
  .field textarea { resize: vertical; }
  .field input[type=file] { width: 100%; }
  .field-error:empty { display: none; }
  .button-primary { box-shadow: 0 2px 4px #153a2614; }
  .brand-mark { color: #f4cf89; }
  .auth-aside { background: radial-gradient(ellipse at 80% 76%, #2d684e, transparent 62%), #102f28; }
  .auth-card .developer-credit { border-block-start: 1px solid var(--line); display: flex; padding-block-start: 16px; }
  .auth-secret code { overflow-wrap: anywhere; }
  .auth-card [data-enrollment-qr] svg { max-width: 100%; height: auto; }
  .auth-card [data-enrollment-qr] { text-align: center; }
  .auth-content { padding-block: max(78px, 5vw) 28px; }
  .route-error > button { justify-self: start; }
  .checkbox-line, .stock-filter-more summary { min-height: 36px; }
  .data-table { font-variant-numeric: tabular-nums; }
  .data-table th { white-space: nowrap; }
  .data-table tbody tr:hover { background: #f5f9f5; }
  .detail-list { display: grid; grid-template-columns: minmax(96px,1fr) 2fr; gap: 7px 14px; margin: 13px 0; }
  .detail-list dt { color: var(--muted); }
  .detail-list dd { margin: 0; font-weight: 640; }
  .scanner-test { display: grid; gap: 16px; }
  .scanner-test-intro { color: var(--muted); line-height: 1.6; }
  .scanner-test-read { display: grid; gap: 7px; }
  .scanner-test-read .field { gap: 7px; }
  .field .scanner-test-input { min-height: 52px; font-size: 1.15rem; font-weight: 600; text-align: center; letter-spacing: .02em; border-width: 2px; border-color: #8fb3a0; background: #fbfdfb; }
  .field .scanner-test-input:focus { border-color: var(--primary); outline: 3px solid #2b8a7233; outline-offset: 0; }
  .scanner-test-result { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(5.5rem,auto); gap: 8px; margin: 0; }
  .scanner-test-tile { display: grid; align-content: start; gap: 5px; min-width: 0; padding: 10px 12px; border: 1px solid #dbe8dd; border-radius: 11px; background: #f4f9f5; }
  .scanner-test-tile dt { color: var(--muted); font-size: .8rem; font-weight: 600; }
  .scanner-test-tile dd { margin: 0; min-height: 1.5em; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .scanner-test-count { text-align: center; }
  .scanner-test-count dd { font-size: 1.3rem; line-height: 1.2; color: var(--primary); }
  .scanner-test-result.is-fresh .scanner-test-tile { animation: scanner-test-fresh .7s ease-out; }
  @keyframes scanner-test-fresh { from { background: #d4efdc; border-color: #7fbf98; } }
  .scanner-test-com { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfa; }
  .scanner-test-com-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  .scanner-test-com-head h3 { margin: 0; font-size: 1rem; }
  .scanner-test-state { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: #eef1ef; color: var(--muted); font-size: .8rem; font-weight: 650; }
  .scanner-test-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #93a39b; }
  .scanner-test-state.is-on { background: #e1f3e7; color: #155b40; }
  .scanner-test-state.is-on::before { background: #1f9d63; }
  .scanner-test-com-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
  .scanner-test-com-row .field { flex: 1 1 9rem; }
  .scanner-test-com-row select { width: 100%; }
  .scanner-test-com-row .button { flex: 1 1 11rem; min-height: 43px; }
  .scanner-test-error { color: #9b2d23; background: #fff4f1; border: 1px solid #f3cfc7; border-radius: 9px; padding: 8px 11px; font-size: .86rem; }
  @media (max-width: 460px) {
    .scanner-test-result { grid-template-columns: minmax(0,1fr); }
    .scanner-test-tile { grid-template-columns: minmax(0,auto) minmax(0,1fr); align-items: baseline; gap: 10px; }
    .scanner-test-tile, .scanner-test-count { text-align: end; }
    .scanner-test-tile dt { text-align: start; }
  }
  @media (max-width: 1150px) {
    .scan-grid { grid-template-columns: minmax(0,1.5fr) minmax(245px,1fr); }
    .app-shell { grid-template-columns: 198px minmax(0,1fr); }
    .scope-label { max-width: 160px; }
  }
  @media (max-width: 935px) {
    .app-shell { grid-template-columns: minmax(0,1fr); }
    .sidebar { display: none; }
    .sidebar.sidebar-open { display: flex; position: fixed; inset-block: 0; inset-inline-start: 0; width: min(310px,90vw); box-shadow: 0 12px 48px #102f2840; }
    .nav-toggle, .drawer-close { display: inline-flex; }
  }
  @media (max-width: 690px) {
    .scan-grid, .split-grid { grid-template-columns: minmax(0,1fr); }
    .activity-card { min-height: 180px; }
    .page-header { align-items: start; }
    .date-pill { display: none; }
    .topbar { height: 62px; padding-inline: 13px; }
    .topbar-crumb { display: none; }
    .topbar-crumb-label { display: none; }
    .scope-label { border: 0; margin: 0; padding: 0; }
    .topbar:has(.instance-logo) {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 5px 8px;
      height: auto;
      padding-block: 9px 5px;
    }
    .topbar:has(.instance-logo) .topbar-start { display: contents; }
    .topbar:has(.instance-logo) .nav-toggle { grid-area: 1 / 1; }
    .topbar:has(.instance-logo) .topbar-crumb { display: flex; grid-area: 1 / 2; }
    .topbar:has(.instance-logo) .topbar-actions { grid-area: 1 / 3; }
    .topbar:has(.instance-logo) .scope-label {
      grid-area: 2 / 1 / 3 / -1;
      max-width: none;
      border-block-start: 1px solid var(--line);
    }
    .topbar:has(.instance-logo) .scope-label select { min-height: 29px; }
    .workspace-main { padding: 18px 13px 24px; }
    .scan-hero { min-height: 178px; }
    .warehouse-list, .admin-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .auth-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .auth-aside { padding: 18px 24px; }
    .auth-aside .barcode-graphic { display: none; }
    .auth-content { padding-block-start: 72px; }
  }
  @media (max-width: 390px) {
    .topbar, .topbar-start, .topbar-actions { gap: 5px; }
    .topbar-button { padding-inline: 6px; }
    .connection-label { display: none; }
    .topbar-inbox { min-width: 32px; }
    .barcode-graphic { min-width: 81px; height: 72px; }
    .scan-hint kbd { display: none; }
    .balance-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .warehouse-list { grid-template-columns: minmax(0,1fr); }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  }
  @media (max-width: 690px) {
    .auth-card { padding: clamp(16px, 4vw, 26px); }
    .auth-content { align-content: start; padding-inline: 14px; }
    .workspace-main { padding-inline: max(14px, env(safe-area-inset-left), env(safe-area-inset-right)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
    .dialog-panel .form-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%, 13rem),1fr)); }
    .topbar-actions { gap: 6px; }
    .nav-toggle, .topbar-actions > :is(button, a), .account-menu summary { min-inline-size: 42px; min-block-size: 42px; }
    .account-menu summary { display: grid; place-items: center; }
    .topbar:has(.instance-logo) .scope-label select { min-height: 38px; }
    .field :is(input, select, textarea), .stock-field :is(input, select, textarea) { font-size: 1rem; }
    .card-head { align-items: flex-start; flex-wrap: wrap; }
  }
  @media (max-width: 520px) {
    .admin-grid, .form-grid { grid-template-columns: minmax(0,1fr); }
    .admin-grid .quick-action { align-items: center; min-height: 62px; }
    .scan-section .quick-action { align-items: flex-start; flex-direction: column; gap: 6px; }
    .workspace-card { padding: 15px; }
    .scan-card { padding: 0; }
    .topbar, .topbar:has(.instance-logo) { display: grid; grid-template-columns: auto minmax(0,1fr) auto; height: auto; gap: 2px 6px; padding: max(6px, env(safe-area-inset-top)) 10px 4px; }
    .topbar .topbar-start { display: contents; }
    .topbar .nav-toggle { grid-area: 1 / 1; }
    .topbar .topbar-crumb { display: flex; grid-area: 1 / 2; }
    .topbar .topbar-actions { grid-area: 1 / 3; gap: 4px; }
    .topbar .scope-label { grid-area: 2 / 1 / 3 / -1; max-width: none; border-block-start: 1px solid var(--line); }
    .topbar .scope-label select { min-height: 38px; }
    .topbar [data-connection] { border: 0; background: transparent; padding-inline: 4px; }
    .topbar .connection-label { display: none; }
    .language-select select { max-width: 88px; }
    .page-header { gap: 10px; margin-block-end: 15px; }
    .balance-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .scan-field { flex-wrap: wrap; }
    .scan-input-wrap { flex: 1 1 9rem; }
    .scan-field > button { flex-grow: 1; }
    .scanned-header { flex-wrap: wrap; }
    .scanned-header > .button { margin-inline-start: 0; }
  }
  @media (max-width: 340px) {
    .topbar .topbar-crumb:not(:has(.instance-logo)) { display: none; }
    .topbar .topbar-actions, .topbar:has(.instance-logo) .topbar-actions { gap: 2px; }
    .nav-toggle, .topbar-actions > :is(button, a), .account-menu summary { min-inline-size: 34px; }
    .language-select select { max-width: 80px; }
  }
}

