/* Shared RTL layout. Screen rules deliberately exclude printed invoices. */
@media screen {
    :root { --app-brand: #85451f; --app-line: #e9e2d8; }
    html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
    body.app-page { min-width: 0; }
    .app-page *, .app-page *::before, .app-page *::after { box-sizing: border-box; }
    .app-page .flex > *, .app-page .grid > * { min-width: 0; }
    .app-page input, .app-page select, .app-page textarea { max-width: 100%; }
    .app-page button, .app-page a, .app-page input, .app-page select { touch-action: manipulation; }
    .app-page :focus-visible { outline: 3px solid #d69a3a; outline-offset: 3px; }
    .app-header { flex: 0 0 auto; width: 100%; background: linear-gradient(110deg,#fff 0%,#fffdf9 52%,#fdf5e8 100%); border-bottom: 1px solid var(--app-line); box-shadow: 0 4px 18px #462b0e0b; position: relative; z-index: 40; }
    .app-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 24px; max-width: 1600px; margin: auto; }
    .app-brand { display: flex; gap: 10px; align-items: center; color: var(--app-brand); font-size: 24px; font-weight: 900; text-decoration: none; letter-spacing: -.4px; }
    .app-brand > i { display: grid; place-items: center; background: linear-gradient(145deg,#9b5728,#6d3517); color:#fff; box-shadow: 0 8px 18px #85451f33; border-radius: 14px; width: 46px; height: 46px; }
    .app-brand small { display: block; font-size: 11px; font-weight: 500; color: #78716c; }
    .app-account { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px; border: 1px solid #eee5d9; border-radius: 16px; background: #fff; box-shadow: 0 2px 8px #462b0e08; }
    .app-user { max-width: 190px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 8px 12px; background: #fbf3e7; color: #713e20; border-radius: 12px; }
    .app-clock { font-variant-numeric: tabular-nums; color: #78716c; }
    .app-logout { display: grid; place-items: center; min-width: 44px; height: 44px; color: #b91c1c; background: #fff1f2; border-radius: 12px; }
    .app-nav-shell { max-width: 1600px; margin:auto; display:flex; align-items:center; gap:12px; padding: 0 24px 10px; }
    .app-navigation { display: flex; flex:1; gap: 6px; overflow-x: auto; padding: 0; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #d4b491 transparent; }
    .app-navigation a { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 10px 14px; min-height: 44px; border-radius: 12px; color: #57534e; white-space: nowrap; font-weight: 700; text-decoration: none; }
    .app-navigation a:hover { background: #faf5ee; }
    .app-navigation a[aria-current] { background: var(--app-brand); color: white; box-shadow: 0 3px 8px #85451f25; }
    .app-public-links { display:flex; gap:6px; flex:0 0 auto; }
    .app-public-links a { display:flex; align-items:center; gap:7px; padding:9px 11px; border-radius:11px; color:#2563eb; background:#eff6ff; font-weight:800; text-decoration:none; font-size:13px; white-space:nowrap; }
    .app-public-links a:first-child { color:#a16207; background:#fffbeb; }
    .app-page > .flex-1 { min-height: 0; }
    .app-page .overflow-x-auto { max-width: 100%; overscroll-behavior-x: contain; }
    .app-page .fixed.inset-0:not(#pdf-loader) { overflow-y: auto; overscroll-behavior-y: contain; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .app-page .fixed.inset-0:not(#pdf-loader) > :is(div, form):not(.absolute) { max-height: calc(100dvh - 32px); overflow-y: auto; }
    .app-page #tomorrow-marquee-container { padding-bottom: env(safe-area-inset-bottom); }
    .app-page[data-page="index"] { height: auto; min-height: 100dvh; overflow-y: auto; padding: 24px 0; background-attachment: fixed; }
    .app-page[data-page="index"] > .absolute.inset-0 { position: fixed; }
    .app-page[data-page="pos"] .pos-workspace > * { flex-shrink: 1; }
    @media (max-width: 1023px) {
        body.app-page { height: auto; min-height: 100dvh; overflow-y: auto; padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
        .app-page > .flex-1 { flex: 0 0 auto; overflow: visible; }
        .app-page .pos-workspace { height: auto; overflow: visible; padding-bottom: 12px; }
        .app-page .pos-workspace > * { height: auto; overflow: visible; }
        .app-page .pos-workspace > * > .overflow-y-auto { overflow: visible; flex: 0 0 auto; }
        .app-page #cart_container { min-height: 150px; max-height: 50dvh; overflow-y: auto; }
        .app-clock { display: none; }
    }
    @media (max-width: 639px) {
        .app-toolbar { padding: 10px 12px; gap: 8px; }
        .app-brand { font-size: 20px; gap: 6px; }
        .app-brand > i { width: 36px; height: 40px; font-size: 19px; }
        .app-brand small { font-size: 10px; }
        .app-account { gap: 6px; }
        .app-user { max-width: 90px; padding: 8px; font-size: 13px; }
        .app-account #db-status-icon { display: none; }
        .app-nav-shell { padding: 0 12px 10px; gap:8px; }
        .app-navigation { padding:0; gap: 4px; }
        .app-navigation a { padding: 9px 12px; font-size: 14px; }
        .app-public-links a span { display:none; }
        .app-public-links a { padding:10px; }
        .app-page input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), .app-page select, .app-page textarea { font-size: 16px !important; min-height: 44px; }
        .app-page button { min-height: 44px; }
        .app-page label { white-space: normal; overflow-wrap: anywhere; }
        .app-page label input[type="checkbox"], .app-page label input[type="radio"] { flex-shrink: 0; }
        .app-page :is(.p-6, .p-8, .p-12) { padding: 16px; }
        .app-page .gap-8 { gap: 20px; }
        .app-page h2.text-3xl, .app-page h3.text-2xl { font-size: 22px; line-height: 1.5; }
        .app-page .flex.justify-between:not(.app-toolbar):not(.app-account) { flex-wrap: wrap; gap: 10px; }
        .app-page .w-64 { width: 100%; }
        .app-page .w-max { max-width: 100%; }
        .app-page .sub-tab { padding: 10px 14px; font-size: 14px; flex-shrink: 0; }
        .app-page .app-tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
        .app-page .pos-workspace h2 { font-size: 20px; }
        .app-page #pay_method { width: auto; flex: 1 1 110px; }
        .app-page .fixed.inset-0:not(#pdf-loader) { padding-inline: 12px; }
        .app-page .fixed.inset-0:not(#pdf-loader) > :is(div, form) { border-radius: 20px; }
    }
    @media (prefers-reduced-motion: reduce) {
        .app-page *, .app-page *::before, .app-page *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    }
}
@media print { .app-header { display: none !important; } }
