/* ============================================================
   pg-core.css - the shared base of the "pg" design language:
   tokens, the fluid page shell, buttons, chips, fields, select,
   view toggle, stat count, empty state, segmented switch, tag,
   label, file picker, table (and the table fitted to the
   screen, with js/pg-core.js), pagination, dialog, keyframes
   and reduced motion. Spec: brain projects/gemryou-web/reference/
   gemryou-design-language.md. Moved unchanged out of
   parcels_split.css on 2026-11-16; page files load this first
   and keep only their own rules. The switch, tag, label, file
   picker, table and dialog were added with manage_inventory.php
   and the pagination with manage_users.php (news.css still
   carries its own earlier .pg-news-* copies).
   ============================================================ */

.pg-page,
.pg-product {
    --pg-navy: #002B5C;
    --pg-navy-2: #20477F;
    --pg-ink: #0E1B2E;
    --pg-muted: #5F6E83;
    --pg-faint: #8E9BAE;
    --pg-line: #E3E9F0;
    --pg-line-strong: #CFD8E3;
    --pg-tint: #F2F6FB;
    --pg-sky: #83C1F5;
    --pg-sky-soft: #DCEBFA;
    --pg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --pg-ease: cubic-bezier(.22, 1, .36, 1);
    --pg-spring: cubic-bezier(.34, 1.56, .64, 1);
    font-family: var(--pg-font);
    font-size: 14px;
    color: var(--pg-ink);
    -webkit-font-smoothing: antialiased;
}

/* ---- Fluid shell: override the 1125px pin for this page only ---- */
body.pg-body { background: #F6F8FB; }
body.pg-body #main_results.pg-main {
    width: auto;
    min-width: 0;
    margin: 0 28px;
}
#site_content.pg-page {
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 0 48px;
    overflow: visible;          /* the rail is sticky */
}
.pg-page [hidden] { display: none !important; }

.pg-ico {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- Buttons ---- */
.pg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: none;
    color: var(--pg-ink);
    font: 600 14px/1 var(--pg-font);
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, box-shadow .18s, transform .18s var(--pg-ease);
}
.pg-btn .pg-ico { width: 16px; height: 16px; transition: transform .25s var(--pg-ease); }
.pg-btn:active { transform: scale(.97); }
.pg-btn:focus-visible,
.pg-chip:focus-visible,
.pg-shape:focus-visible,
.pg-type:focus-visible,
.pg-rail-step:focus-visible,
.pg-view-btn:focus-visible,
.pg-select:focus-visible {
    outline: 2px solid var(--pg-sky);
    outline-offset: 2px;
}
.pg-btn-solid { background: var(--pg-navy); color: #fff; box-shadow: 0 6px 16px rgba(0, 43, 92, .22); }
.pg-btn-solid:hover { background: #063A75; }
.pg-btn-solid:hover .pg-ico { transform: translateX(3px); }
/* Next with nothing chosen reads "Any shape": an outline, not a call to act. */
.pg-btn-solid.pg-btn-any { background: #fff; color: var(--pg-navy); border-color: var(--pg-line-strong); box-shadow: none; }
.pg-btn-solid.pg-btn-any:hover { border-color: var(--pg-navy); }
.pg-btn-quiet { padding: 0 12px; color: var(--pg-muted); }
.pg-btn-quiet:hover { background: #E9EEF5; color: var(--pg-ink); }
.pg-btn-line { background: #fff; border-color: var(--pg-line-strong); }
.pg-btn-line:hover { border-color: var(--pg-navy); }

/* ---- Title row ---- */
.pg-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 40px;
    margin-bottom: 16px;
}
.pg-page .pg-title {
    margin: 0;
    padding: 0;
    font: 600 28px/1.1 var(--pg-font);
    letter-spacing: -.02em;
    color: var(--pg-ink);
    text-shadow: none;
}

/* ---- Chips ---- */
.pg-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pg-chip {
    height: 40px;
    padding: 0 18px;
    background: #fff;
    border: 1px solid var(--pg-line-strong);
    border-radius: 999px;
    color: var(--pg-ink);
    font: 500 14px/1 var(--pg-font);
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, box-shadow .18s, transform .18s var(--pg-ease);
}
.pg-chip:hover { border-color: var(--pg-navy); }
.pg-chip:active { transform: scale(.94); }
.pg-chip.selected {
    background: var(--pg-navy);
    border-color: var(--pg-navy);
    color: #fff;
    box-shadow: 0 6px 14px rgba(0, 43, 92, .22);
}

/* ---- Text field ---- */
.pg-field {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 168px;
    height: 46px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--pg-line-strong);
    border-radius: 12px;
    cursor: text;
    transition: border-color .18s, box-shadow .18s;
}
.pg-field:focus-within { border-color: var(--pg-navy); box-shadow: 0 0 0 3px rgba(0, 43, 92, .12); }
.pg-field input {
    width: 100%;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--pg-ink);
    font: 500 15px/1 var(--pg-font);
}
.pg-field input::placeholder { color: var(--pg-faint); font-weight: 400; }
.pg-field-unit { color: var(--pg-faint); font: 600 15px/1 var(--pg-font); }

/* ---- Stat count ---- */
.pg-count { color: var(--pg-muted); font: 400 14px/1 var(--pg-font); }
.pg-count-num {
    margin-right: 2px;
    color: var(--pg-ink);
    font: 600 22px/1 var(--pg-font);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

/* ---- Select and view toggle ---- */
.pg-select {
    height: 40px;
    padding: 0 38px 0 16px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6E83' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
    border: 1px solid var(--pg-line-strong);
    border-radius: 999px;
    color: var(--pg-ink);
    font: 500 14px/1 var(--pg-font);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .18s;
}
.pg-select:hover { border-color: var(--pg-navy); }
.pg-view { display: inline-flex; padding: 3px; background: #E7ECF3; border-radius: 999px; }
.pg-view-btn {
    width: 40px;
    height: 34px;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: 999px;
    color: var(--pg-muted);
    cursor: pointer;
    transition: background .2s, color .2s, box-shadow .2s;
}
.pg-view-btn:hover { color: var(--pg-ink); }
.pg-view-btn.active { background: #fff; color: var(--pg-navy); box-shadow: 0 1px 3px rgba(14, 27, 46, .16); }

/* ---- Empty state ---- */
.pg-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 56px 16px;
    background: #fff;
    border: 1px dashed var(--pg-line-strong);
    border-radius: 16px;
    animation: pg-fade .4s ease;
}
.pg-empty-title { color: var(--pg-muted); font: 500 15px/1.3 var(--pg-font); }

/* ---- Segmented switch with words: radio labels, or links for tabs ---- */
.pg-seg { display: inline-flex; padding: 3px; background: #E7ECF3; border-radius: 999px; }
.pg-seg-opt { position: relative; display: inline-flex; border-radius: 999px; cursor: pointer; }
.pg-page a.pg-seg-opt,
.pg-page a.pg-seg-opt:hover { text-decoration: none; }
.pg-seg-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pg-seg-opt span {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 18px;
    border-radius: 999px;
    color: var(--pg-muted);
    font: 500 14px/1 var(--pg-font);
    white-space: nowrap;
    transition: background .2s, color .2s, box-shadow .2s;
}
.pg-seg-opt:hover span { color: var(--pg-ink); }
.pg-seg-opt input:checked + span,
.pg-seg-opt.is-active span { background: #fff; color: var(--pg-navy); font-weight: 600; box-shadow: 0 1px 3px rgba(14, 27, 46, .16); }
.pg-seg-opt input:focus-visible + span,
a.pg-seg-opt:focus-visible span { outline: 2px solid var(--pg-sky); outline-offset: 2px; }

/* ---- Tag ---- */
.pg-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--pg-tint);
    border-radius: 999px;
    color: var(--pg-muted);
    font: 600 12px/1 var(--pg-font);
    white-space: nowrap;
}
.pg-tag.is-on { background: var(--pg-sky-soft); color: var(--pg-navy); }

/* ---- Micro label above a control (muted: it must be read to act) ---- */
.pg-page .pg-label {
    display: block;
    margin: 0 0 9px;
    color: var(--pg-muted);
    font: 600 11px/1 var(--pg-font);
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ---- File picker: a line button over a transparent file input ---- */
.pg-file { position: relative; overflow: hidden; max-width: 100%; }
.pg-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pg-file:has(input:focus-visible) { outline: 2px solid var(--pg-sky); outline-offset: 2px; }
.pg-file-name { overflow: hidden; text-overflow: ellipsis; }

/* ---- Table ---- */
.pg-table-wrap {
    box-sizing: border-box;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 16px;
}
.pg-table { width: 100%; border-collapse: collapse; }
.pg-page .pg-table th {
    padding: 14px 10px;
    background: none;
    border-bottom: 1px solid var(--pg-line);
    color: var(--pg-faint);
    font: 600 11px/1 var(--pg-font);
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.pg-page .pg-table td {
    padding: 9px 10px;
    background: none;
    border-bottom: 1px solid #EEF2F7;
    color: var(--pg-ink);
    font: 400 13px/1.4 var(--pg-font);
    vertical-align: middle;
    transition: background .15s;
}
.pg-page .pg-table tbody tr:last-child td { border-bottom: 0; }
.pg-page .pg-table tbody tr:hover td { background: var(--pg-tint); }

/* ---- A table fitted to the screen: .pg-table-fit on the wrap. It scrolls
   inside itself and js/pg-core.js sets a measured max-height so it ends just
   above the bottom of the window; this is the fallback. The header row stays
   while the rows scroll under it: its hairline is a shadow, because a
   collapsed border does not travel with a sticky cell. A cell that is also
   pinned sideways (a corner) needs z-index 3 and both hairlines. ---- */
@media (min-width: 561px) and (min-height: 600px) {
    .pg-table-fit { overflow: auto; max-height: calc(100vh - 300px); overscroll-behavior: contain; }
}
.pg-page .pg-table-fit .pg-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    border-bottom: 0;
    box-shadow: inset 0 -1px 0 var(--pg-line);
}

/* ---- Pagination ---- */
.pg-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 28px 0 0; }
.pg-page .pg-pager-item {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 999px;
    color: var(--pg-ink);
    font: 500 13px/1 var(--pg-font);
    text-decoration: none;
    transition: border-color .18s, background .18s, color .18s;
}
.pg-page a.pg-pager-item:hover { border-color: var(--pg-navy); color: var(--pg-navy); }
.pg-page a.pg-pager-item:focus-visible { outline: 2px solid var(--pg-sky); outline-offset: 2px; }
.pg-page .pg-pager-item.is-current { background: var(--pg-navy); border-color: var(--pg-navy); color: #fff; font-weight: 600; }

/* ---- Dialog: a native <dialog>, opened with showModal() ---- */
.pg-dialog {
    width: min(420px, calc(100vw - 28px));
    box-sizing: border-box;
    margin: auto;               /* the site CSS zeroes the browser's centring margin */
    padding: 26px 26px 20px;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(14, 27, 46, .04), 0 12px 32px rgba(14, 27, 46, .06);
    color: var(--pg-ink);
}
.pg-dialog[open] { animation: pg-pop .35s var(--pg-ease); }
.pg-dialog::backdrop { background: rgba(14, 27, 46, .32); }
.pg-page .pg-dialog-q {
    margin: 0;
    padding: 0;
    color: var(--pg-ink);
    font: 600 19px/1.35 var(--pg-font);
    letter-spacing: -.01em;
    text-shadow: none;
}
.pg-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

@keyframes pg-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pg-fade { from { opacity: 0; } }
@keyframes pg-pop { from { opacity: 0; transform: translateY(8px) scale(.94); } }
@keyframes pg-flip { from { opacity: 0; transform: translateY(6px); } }
@keyframes pg-bob { 40% { transform: translateY(-4px); } }
@keyframes pg-in { from { opacity: 0; transform: translateX(calc(var(--pg-dir) * 40px)); } }
@keyframes pg-out { to { opacity: 0; transform: translateX(calc(var(--pg-dir) * -28px)); } }

/* ---- Small screens ---- */
@media (max-width: 900px) {
    body.pg-body #main_results.pg-main { margin: 0 14px; }
    #site_content.pg-page { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .pg-page *,
    .pg-page *::before { animation: none !important; transition: none !important; }
}
