/* Responsive shell only. Base tokens/controls live in app.css. */
:root { --header-height: 68px; --nav-height: 0px; --sidebar-width: 232px; }
body { padding-top: calc(var(--header-height) + env(safe-area-inset-top)); }
.shell { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
main.shell { min-height: 75vh; padding-block: 24px; }
footer.shell { padding-block: 24px; font-size: 13px; color: var(--app-muted); }
.authenticated > main.shell, .authenticated > footer.shell { width: auto; max-width: 1128px; margin-left: var(--sidebar-width); margin-right: auto; padding-inline: 32px; }
/* Page header: dark primary band. On desktop it starts beside the full-height sidebar. */
.app-header { position: fixed; inset: 0 0 auto; z-index: 40; background: var(--app-green); color: white; padding-top: env(safe-area-inset-top); }
.authenticated .app-header { left: var(--sidebar-width); }
.header-content { height: var(--header-height); width: auto; margin: 0; padding-inline: 24px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: white; text-decoration: none; min-height: 44px; margin-right: auto; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-control); background: var(--app-action); color: var(--app-action-ink); font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1; }
.brand-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-name > span { display: block; font-size: 14px; font-weight: 500; color: var(--app-on-dark); }
.authenticated .app-header .brand { display: none; }
.header-title { display: block; flex: 1; min-width: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Header subtitle (route line) under the title on phones and tablets; desktop keeps it in the page. */
.header-heading { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.header-subtitle { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--app-on-dark); font-size: 13px; line-height: 1.3; }
.header-subtitle > [hidden] { display: none; }
.header-unit { flex-shrink: 0; padding: 6px 10px; border-radius: var(--radius-control); background: var(--app-raised); font-size: 13px; font-weight: 700; white-space: nowrap; }
.app-icon { width: 22px; height: 22px; flex-shrink: 0; }
.app-header :focus-visible { outline-color: var(--app-action); }
.header-back, .notification-bell { display: grid; place-items: center; flex-shrink: 0; min-width: 44px; min-height: 44px; color: white; border-radius: var(--radius-control); text-decoration: none; background: var(--app-raised); }
.header-back { order: -1; background: transparent; margin-left: -10px; }
button.header-back { padding: 0; border: 0; }
.header-back[hidden] { display: none; }
.notification-bell { position: relative; }
.notification-bell > span { position: absolute; top: -4px; right: -4px; min-width: 20px; padding: 2px 5px; border-radius: 10px; background: var(--app-error); color: white; font-size: 12px; font-weight: 700; line-height: 1.2; text-align: center; }
.account-menu summary { display: grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: var(--radius-control); background: var(--app-raised); cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu[open] summary { background: var(--app-panel); color: var(--app-green); }
.account-menu-panel { position: absolute; top: 100%; right: 16px; width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - var(--header-height) - env(safe-area-inset-top) - var(--nav-height) - 16px); overflow-y: auto; overscroll-behavior: contain; background: var(--app-panel); color: var(--app-ink); padding: 16px; border: 1px solid var(--app-border); border-radius: 0 0 var(--radius-card) var(--radius-card); box-shadow: 0 12px 24px rgba(8, 40, 34, .2); }
.account-menu-panel :focus-visible { outline-color: var(--app-green); }
.menu-account { margin: 0 0 16px; overflow-wrap: anywhere; }
.menu-account strong, .menu-account span { display: block; }
.menu-account span { margin-top: 4px; font-size: 14px; color: var(--app-muted); }
.account-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-block: 8px; }
.account-link .app-icon { width: 20px; height: 20px; }
.account-home { margin: -8px 0 12px; padding-inline: 12px; border-radius: var(--radius-control); color: var(--app-green); font-weight: 700; text-decoration: none; background: var(--app-tint); }
.account-home[aria-current=page] { background: var(--app-green); color: white; }
.account-menu-panel .main-nav a { color: var(--app-ink); }
.account-menu-panel .main-nav a[aria-current=page] { background: var(--app-green); color: white; font-weight: 700; }
/* Desktop sidebar: full-height dark primary with logo, menu, then account links at the bottom. */
.app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 41; width: var(--sidebar-width); padding: calc(20px + env(safe-area-inset-top)) 12px 16px; overflow-y: auto; background: var(--app-green); color: white; display: flex; flex-direction: column; gap: 20px; }
.sidebar-brand { margin: 0; padding: 0 8px; }
.main-nav { display: flex; flex-direction: column; gap: 2px; }
.main-nav a { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 44px; color: var(--app-muted); border-radius: var(--radius-control); text-decoration: none; font-size: 15px; font-weight: 500; }
.main-nav .app-icon { width: 20px; height: 20px; }
.app-sidebar .main-nav a { color: white; }
.app-sidebar .main-nav a[aria-current=page] { background: var(--app-panel); color: var(--app-green); font-weight: 700; }
.app-sidebar .secondary-nav { padding-top: 12px; border-top: 1px solid var(--app-raised); }
.app-sidebar :focus-visible { outline-color: var(--app-action); }
.nav-heading { margin: 24px 12px 8px; }
.sidebar-account { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--app-raised); }
.sidebar-account .menu-account { margin-bottom: 4px; font-size: 14px; }
.sidebar-account .menu-account span { color: var(--app-on-dark); font-size: 13px; }
.sidebar-account .account-link, .sidebar-account .sidebar-logout { width: 100%; margin: 0; padding: 0; justify-content: flex-start; gap: 10px; min-height: 44px; background: transparent; border: 0; color: var(--app-on-dark); font-size: 14px; font-weight: 500; text-decoration: none; }
.sidebar-account .account-link[aria-current=page] { color: white; font-weight: 700; }
.sidebar-account form { margin: 0; }
.bottom-nav { display: none; }
.guest main { min-height: calc(100dvh - 160px); }
#push-settings { margin-bottom: 24px; }
#push-settings button { margin: 4px 8px 4px 0; }
@media (hover: hover) {
    .account-menu-panel .main-nav a:hover { background: var(--app-tint); color: var(--app-green); }
    .app-sidebar .main-nav a:not([aria-current=page]):hover, .sidebar-account a:hover, .sidebar-account .sidebar-logout:hover { background: var(--app-raised); color: white; }
    .bottom-nav a:not([aria-current=page]):hover { background: var(--app-tint); color: var(--app-green); }
}
/* Desktop at 1280px+ (redesign step 6): screens keep their phone layout in a 720px column centred
   beside the sidebar; Home, Inventori and Picking opt into the full width with the wide-page body class.
   1101-1279px keeps the earlier desktop layout. */
@media (min-width: 1280px) {
    .authenticated > main.shell, .authenticated > footer.shell { max-width: none; margin-right: 0; padding-inline: max(32px, calc((100% - var(--sidebar-width) - 720px) / 2)); }
    .authenticated.wide-page > main.shell, .authenticated.wide-page > footer.shell { padding-inline: 40px; }
    .authenticated.wide-page > main.shell { padding-top: 32px; }
}
@media (max-width: 1100px) {
    :root { --nav-height: calc(64px + env(safe-area-inset-bottom)); }
    .authenticated { padding-bottom: var(--nav-height); }
    .app-sidebar { display: none; }
    .authenticated .app-header { left: 0; }
    .header-content { padding-inline: 16px; }
    .authenticated > main.shell, .authenticated > footer.shell { margin-inline: auto; width: 100%; padding-inline: 24px; }
    /* Bottom navigation: four tabs; the active tab is a solid primary block. */
    .bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: var(--nav-height); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--app-panel); border-top: 2px solid var(--app-green); }
    .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 62px; min-width: 0; padding: 4px 2px; color: var(--app-muted); text-decoration: none; font-size: 12px; font-weight: 600; line-height: 1.2; }
    .bottom-nav a[aria-current=page] { background: var(--app-green); color: white; font-weight: 700; }
    .bottom-nav a span { overflow-wrap: anywhere; text-align: center; }
}
/* Redesign fixes (23 November 2026), phones and tablets below 1100px:
   - the header bar carries the title, so the in-page h1 stays for screen readers only;
   - a dark search band (.page-band) joins the header with no gap and runs edge to edge;
   - working screens with their own action bar (work-page) hide the bottom tabs. */
@media (max-width: 1100px) {
    :root { --gutter: 24px; }
    .authenticated > main.shell h1 { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .authenticated > main.shell .page-band { margin-top: -24px; margin-inline: calc(-1 * var(--gutter)); border-radius: 0; }
    .header-subtitle { display: block; }
    .authenticated > main.shell .page-route { display: none; }
    /* Permintaan tabs (Final-RequestsWarehouse): a raised strip inside the dark band. */
    .queue-band { margin-bottom: 16px; padding: 4px var(--gutter) 12px; background: var(--app-green); }
    .queue-band .queue-tabs { margin: 0; background: var(--app-raised); }
    .work-page { --nav-height: 0px; }
    .work-page .bottom-nav { display: none; }
    /* Summary and the main button side by side (Final-Picking), never stacked. */
    .work-page .action-bar, #workspace-actions { flex-wrap: nowrap; }
    .work-page .action-bar .action-summary, #workspace-actions .action-summary { flex: 1 1 auto; min-width: 0; }
    .work-page .action-bar button, .work-page .action-bar .action-link, #workspace-actions button { width: auto; flex: 0 0 auto; }
    /* A bar without a summary (Selesaikan selisih) keeps its one button full width. */
    .work-page .action-bar:not(:has(.action-summary)) button { flex: 1 1 auto; }
    /* Two visible buttons (review: Ubah + commit) take their own row under the summary. */
    .work-page .action-bar:has(button:not([hidden]) ~ button:not([hidden])) { flex-wrap: wrap; }
    .work-page .action-bar:has(button:not([hidden]) ~ button:not([hidden])) .action-summary { flex-basis: 100%; }
    .work-page .action-bar:has(button:not([hidden]) ~ button:not([hidden])) button:not([hidden]) { flex: 1 1 0; min-width: 0; padding-inline: 12px; }
    .work-page .action-bar:has(button:not([hidden]) ~ button:not([hidden])) button.secondary:not([hidden]) { flex: 0 0 auto; }
}
@media (max-width: 600px) {
    :root { --gutter: 16px; }
    .shell { width: calc(100% - 32px); }
    .header-content.shell { width: 100%; }
    .header-title { font-size: 20px; }
    .authenticated > main.shell, .authenticated > footer.shell { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
    /* Detail screens (with a back chevron) drop the unit label so the title has room. */
    .header-back:not([hidden]) ~ .header-unit { display: none; }
}
@media (max-width: 360px) {
    .header-unit { display: none; }
}
@media print {
    body, .authenticated { padding: 0; }
    .app-header, .app-sidebar, .bottom-nav, .skip-link { display: none; }
    .authenticated > main.shell { margin: 0; padding: 0; max-width: none; }
}

/* Android browser tabs show onboarding; the installed standalone window shows the app. */
.android-install-required body { padding: 0; }
.android-install-required body > :not(#android-install-gate):not(script) { display: none !important; }
#android-install-gate { flex-direction: column; min-height: 100dvh; background: var(--app-panel); }
.android-install-required #android-install-gate { display: flex !important; }
.install-column { width: 100%; max-width: 528px; margin: 0 auto; padding-inline: max(24px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-right)); box-sizing: border-box; }
.install-brand { position: relative; display: flex; align-items: flex-end; flex-shrink: 0; min-height: 320px; padding: env(safe-area-inset-top) 0 24px; background: var(--app-green); color: white; box-sizing: border-box; }
.install-brand .install-column { display: flex; align-items: center; gap: 14px; }
.install-brand .brand-mark { width: 52px; height: 52px; font-size: 32px; }
.install-brand-name { display: flex; flex-direction: column; margin: 0; font-family: var(--font-display); line-height: 1; }
.install-brand-name strong { font-size: 30px; font-weight: 700; }
.install-brand-name span { margin-top: 2px; font-size: 17px; font-weight: 500; color: var(--app-action); }
/* Quiet escape to the browser: icon only, muted on the dark green. */
.install-browser { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: 44px; height: 44px; min-height: 44px; padding: 0; background: transparent; color: #4f8a7b; }
.install-browser .app-icon { width: 20px; height: 20px; stroke-width: 2; }
.install-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 16px; padding-top: 28px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.install-body > * { margin: 0; }
.install-body h1 { font-size: 26px; line-height: 1.15; }
.install-lead { font-size: 16px; color: var(--app-muted); }
#install-app-button { width: 100%; min-height: 56px; font-size: 17px; }
.install-steps { display: flex; flex-direction: column; gap: 14px; padding: 0; list-style: none; }
.install-steps li { display: flex; align-items: flex-start; gap: 12px; font-size: 16px; }
.install-steps li > span:last-child { padding-top: 3px; }
.install-step-number { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px; background: var(--app-green); color: white; font-size: 14px; font-weight: 700; }
.install-help { font-size: 14px; color: var(--app-muted); }
#install-app-message:empty { display: none; }
#android-install-gate:not([data-mode=prompt]) .install-prompt-only, #android-install-gate:not([data-mode=manual]) .install-manual-only { display: none; }
.install-app-footer { margin-top: auto !important; font-size: 12px; color: var(--app-muted); }
