/* Layout: header, main menu, the page, page heads; login pages. */

/* ---------- Header ---------- */
.app-header {
    position: sticky; top: 0; z-index: var(--z-header);
    background-color: #ffffff;
    border-bottom: 1px solid #e5eaf0;
}
/* Phones (r642): the header slides away while scrolling down, and back on a small scroll up (core/phonescroll.js). */
@media (max-width: 760px), (max-height: 500px) {
    .app-header { transition: transform 0.22s ease; }
    :root.hdr-away .app-header { transform: translateY(-100%); }
}
.hdr-top {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
    height: 56px; padding: 0 var(--gutter);
}
.brand { display: flex; align-items: center; gap: 10px; color: #0f172a; }
.brand:hover { color: #0f172a; }
.brand-logo { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: var(--fs-base); letter-spacing: 0.02em; line-height: 1.15; }
.brand-text small { font-weight: 500; font-size: var(--fs-xs); letter-spacing: 0; color: #64748b; }
.hdr-right { display: flex; align-items: center; gap: var(--sp-3); }
.hdr-tools { display: flex; align-items: center; gap: 2px; padding: 2px; background-color: #f5f7fa; border: 1px solid #e8edf3; border-radius: var(--r-md); }
.tool-btn {
    display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 28px; padding: 0 8px;
    font-size: var(--fs-md); font-weight: 600; color: #475569; background-color: transparent; border: 0; border-radius: var(--r-sm);
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tool-btn:hover { color: #1e293b; background-color: #ffffff; }
.tool-btn:disabled { opacity: 0.45; }
.user-btn {
    display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 4px;
    color: #1e293b; background-color: transparent; border: 1px solid transparent; border-radius: var(--r-pill);
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background-color: #f5f7fa; border-color: #e8edf3; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    font-size: var(--fs-sm); font-weight: 700; color: #1d4ed8; background-color: #eaf1fe; border-radius: 50%;
}
.user-name { font-weight: 600; font-size: var(--fs-md); }
.user-caret { font-size: 10px; color: #94a3b8; }

/* ---------- Main menu ---------- */
.hdr-nav {
    display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
    padding: 0 calc(var(--gutter) - 10px) 8px;
}
.nav-guides { margin-left: auto; }
.nav-link {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px;
    font-size: var(--fs-md); font-weight: 500; color: #475569; background-color: transparent;
    border: 0; border-radius: var(--r-md);
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-link .fa-solid { font-size: 13px; color: #94a3b8; transition: color var(--t-fast) var(--ease); }
.nav-link:hover, .nav-link[aria-expanded="true"] { color: #1e293b; background-color: #f1f5f9; }
.nav-link:hover .fa-solid { color: #64748b; }
.nav-link.is-active { color: #1d4ed8; background-color: #eff6ff; }
.nav-link.is-active .fa-solid { color: #3b6fe0; }
.nav-caret { font-size: 9px; }

/* ---------- The page ---------- */
.page { padding: var(--sp-6) var(--gutter) 64px; max-width: 1680px; margin: 0 auto; }
/* Pages that show more the wider the screen (the Stock list): the whole window, however big. */
.page.is-wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.page-title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.01em; }
.page-title-icon { font-size: 0.8em; color: #94a3b8; }
.page-sub { margin-top: 4px; color: #64748b; font-size: var(--fs-md); }
.page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.section { margin-top: var(--sp-8); }
.section-title { font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--sp-3); }
.section-sub { color: #64748b; font-size: var(--fs-md); margin: -6px 0 var(--sp-3); }

/* ---------- Login and first-start pages ---------- */
.layout-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--sp-6) var(--sp-4); }
.auth-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: var(--sp-5); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.auth-logo { width: 44px; height: 44px; }
.auth-brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: var(--fs-lg); letter-spacing: 0.02em; line-height: 1.2; color: #0f172a; }
.auth-brand-text small { font-weight: 500; font-size: var(--fs-sm); letter-spacing: 0; color: #64748b; }
.auth-card {
    display: flex; flex-direction: column; gap: var(--sp-4); padding: 28px;
    background-color: #ffffff; border: 1px solid #e5eaf0; border-radius: var(--r-xl);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.08);
}
.auth-title { font-size: var(--fs-xl); font-weight: 650; }
.auth-sub { margin-top: -10px; color: #64748b; font-size: var(--fs-md); }
.auth-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.auth-tools { display: flex; justify-content: center; }

/* Narrower screens: the menu stays on one line; only the page you are on keeps its name, the rest show their icon
   (the name comes on hover). */
@media (max-width: 1180px) {
    .hdr-nav { flex-wrap: nowrap; }
    .nav-link:not(.is-active) span { display: none; }
    .nav-link:not(.is-active) .fa-solid:not(.nav-caret) { font-size: 15px; }
    .nav-link { padding: 0 9px; }
}
@media (max-width: 760px) {
    :root { --gutter: 16px; }
    .user-name, .hdr-tools [data-font] { display: none; }
    .nav-link span { display: none; }
    /* A phone: the menu icons go on two lines rather than past the right edge (which made the whole page wider). */
    .hdr-nav { flex-wrap: wrap; row-gap: 2px; }
    .nav-link { padding: 0 8px; }
}

/* ---------- Who is online (header) ---------- */
.online-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
    font-size: var(--fs-md); font-weight: 500; color: #334155; background-color: transparent; border: 1px solid transparent; border-radius: var(--r-pill);
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.online-btn:hover, .online-btn[aria-expanded="true"] { background-color: #f5f7fa; border-color: #e8edf3; }
.online-btn strong { font-weight: 700; }
.online-dot { flex: none; width: 8px; height: 8px; background-color: #22a861; border-radius: 50%; box-shadow: 0 0 0 3px rgba(34, 168, 97, 0.16); }
.online-dot.is-away { background-color: #b4bfcd; box-shadow: none; }
.online-menu { width: min(340px, calc(100vw - 24px)); }
.online-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.online-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.online-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.online-name { font-size: var(--fs-md); font-weight: 600; color: #0f172a; }
.online-name small { font-size: var(--fs-md); font-weight: 400; color: #94a3b8; }
.online-sub { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--fs-sm); color: #64748b; }
.online-row.is-away .avatar { color: #64748b; background-color: #eef2f6; }
.online-row.is-away .online-name { color: #475569; }
.online-empty { margin: 0; padding: 6px 10px 8px; font-size: var(--fs-sm); color: #94a3b8; }
@media (max-width: 640px) {
    .online-word { display: none; }
    /* On a phone the header lists open under the header, across the screen (not off its left edge). */
    .menu.online-menu, .menu.bell-menu { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; }
    .brand-text { white-space: nowrap; }
    .brand-text small { display: none; }
}
/* A narrow phone: the logo alone (the name does not fit beside the tools). */
@media (max-width: 480px) { .brand-text { display: none; } }

/* ---------- The bell (header) ---------- */
.bell-btn { position: relative; width: 36px; height: 36px; border-radius: var(--r-md); }
.bell-count {
    position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; font-weight: 700; line-height: 16px;
    text-align: center; color: #ffffff; background-color: #dc2626; border-radius: 8px; box-shadow: 0 0 0 2px #ffffff;
}
.bell-menu { width: min(360px, calc(100vw - 24px)); }
.bell-list { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.bell-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; font-size: var(--fs-md); line-height: 1.4; color: #334155; text-decoration: none; border-top: 1px solid #eef2f6; }
.bell-item:hover { background-color: #f8fafc; }
.bell-item.is-new { color: #0f172a; font-weight: 600; box-shadow: inset 3px 0 0 #2563eb; }
.bell-item small { font-size: var(--fs-sm); font-weight: 400; color: #94a3b8; }
.bell-row { position: relative; display: flex; align-items: flex-start; gap: 2px; padding-right: 6px; border-top: 1px solid #eef2f6; }
.bell-row .bell-item { flex: 1; min-width: 0; padding-right: 4px; border-top: 0; }
.bell-x { flex: none; margin-top: 8px; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: #94a3b8; cursor: pointer; opacity: 0; }
.bell-row:hover .bell-x, .bell-x:focus-visible { opacity: 1; }
.bell-x:hover { color: #b91c1c; background-color: #fef2f2; }
.bell-x[data-read] { opacity: 1; color: #2563eb; }
.bell-x[data-read]:hover { color: #1d4ed8; background-color: #eff6ff; }
.bell-foot { display: flex; justify-content: space-between; border-top: 1px solid #eef2f6; }
.bell-foot .bell-all { border-top: 0; }
.bell-foot .bell-all[data-read]:hover { color: #1d4ed8; background-color: #eff6ff; }
.bell-all { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 9px 12px; border: 0; border-top: 1px solid #eef2f6; background: none; color: #64748b; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.bell-all:hover { color: #b91c1c; background-color: #fef2f2; }
@media (hover: none) { .bell-x { opacity: 1; } }
.bell-empty { margin: 0; padding: 10px 12px 12px; font-size: var(--fs-md); color: #94a3b8; }


/* See it as staff: the admin switched to a test staff account. */
.menu-switch, .menu-back { gap: 8px; white-space: nowrap; }
.menu-switch .pill, .menu-back .pill { margin-left: auto; }
.menu-switch { color: #b45309; }
.hdr-switch { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 6px var(--gutter, 16px);
    background: #fff4e0; color: #8a4b08; border-top: 1px solid #f5dfb5; font-size: var(--fs-sm); }

/* ---------- One search box for everything (header) ---------- */
.omni { position: relative; flex: 1; max-width: 420px; margin: 0 var(--sp-3) 0 auto; }
.omni-open { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 8px 0 12px; font: inherit; font-size: var(--fs-md); color: #94a3b8; text-align: left; background-color: #f5f7fa; border: 1px solid #e8edf3; border-radius: var(--r-md); cursor: text; }
.omni-open:hover { border-color: #cfd8e3; }
.omni-ph { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.omni-open kbd { padding: 0 6px; font: inherit; font-size: var(--fs-xs); color: #64748b; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 4px; }
.omni-box { position: absolute; top: -4px; left: -8px; right: -8px; z-index: calc(var(--z-header) + 5); min-width: 480px; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-lg); box-shadow: 0 18px 40px -14px rgba(15, 23, 42, 0.32); animation: pop-in var(--t-fast) var(--ease); }
.omni-field { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid #eef2f6; }
.omni-field i { color: #3b6fe0; }
.omni-input { flex: 1; min-width: 0; height: 46px; font: inherit; font-size: var(--fs-md); color: #0f172a; background: none; border: 0; outline: none; }
.omni-list { max-height: min(60vh, 520px); padding: 6px; overflow-y: auto; }
.omni-group + .omni-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid #f1f4f8; }
.omni-h { display: flex; align-items: center; gap: 6px; margin: 6px 8px 4px; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: #94a3b8; }
.omni-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; color: #1e293b; border-radius: var(--r-md); text-decoration: none; }
.omni-kind { flex: none; min-width: 78px; padding: 3px 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-align: center; text-transform: uppercase; color: #3b6fe0; background-color: #eff6ff; border: 1px solid #c9dafb; border-radius: 999px; }
.omni-kind.is-orders { color: #0f766e; background-color: #ecfdf5; border-color: #b7ead6; }
.omni-kind.is-products, .omni-kind.is-stock { color: #7046d6; background-color: #f5f1ff; border-color: #ddd0fb; }
.omni-kind.is-serials { color: #b45309; background-color: #fff7ed; border-color: #fbd9b0; }
.omni-kind.is-offers, .omni-kind.is-receipts, .omni-kind.is-makers, .omni-kind.is-incoming { color: #475569; background-color: #f1f5f9; border-color: #dfe5ec; }
.omni-kind.is-fedex { color: #6d28d9; background-color: #f5f1ff; border-color: #e0d5fb; }
.omni-main { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.omni-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.omni-tag { flex: none; font-size: var(--fs-xs); font-weight: 600; color: #64748b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.omni-help { padding: 6px 4px; }
.omni-help { padding: 0; }
.omni-pre { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 12px 14px; background-color: #f4f6f9; border-bottom: 1px solid #e8edf3; }
.omni-help .omni-empty { padding: 12px 14px; }
.omni-pre-h { margin-right: 4px; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: #94a3b8; }
.omni-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; font: inherit; font-size: var(--fs-sm); color: #334155; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-md); cursor: pointer; }
.omni-chip b { color: #2563eb; }
.omni-chip:hover { border-color: #9dbaf5; background-color: #f5f8ff; }
.omni-help .omni-empty { text-align: center; }
.omni-item:hover, .omni-item.is-on { color: #1e293b; background-color: #f1f5f9; }
.omni-item.is-on .omni-title { color: #2563eb; }
.omni-title { overflow: hidden; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.omni-sub { overflow: hidden; font-size: var(--fs-xs); color: #64748b; white-space: nowrap; text-overflow: ellipsis; }
.omni-item mark { color: inherit; background-color: #fff3bf; border-radius: 2px; }
.omni-empty { margin: 0; padding: 14px 10px; font-size: var(--fs-sm); color: #64748b; }
.omni-keys { margin: 0; padding: 6px 14px; font-size: var(--fs-xs); color: #94a3b8; border-top: 1px solid #eef2f6; }
@media (max-width: 1100px) { .omni { max-width: 46px; } .omni-ph, .omni-open kbd { display: none; } .omni-open { justify-content: center; padding: 0; } .omni-box { left: auto; right: -8px; width: min(440px, calc(100vw - 24px)); } }
@media (max-width: 760px) { .omni-box { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; min-width: 0; } .omni-keys { display: none; } }

/* Closed for a while (r618): the admin sees this strip while everyone else sees the closed page. */
.hdr-closed { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 6px var(--gutter, 16px);
    background: #fdecec; color: #9f1d1d; border-top: 1px solid #f6caca; font-size: var(--fs-sm); }
