/* Applewood Portal — Applewood Fresh branding (applewoodfresh.com).
   Palette lifted from their logo SVG: script-red #da1f26, leaf-green
   #46a929. White chrome to match their site; the deep green is our own
   darkening of the leaf green so white button text keeps AA contrast. */
:root {
    --brand-red: #da1f26; --brand-red-dark: #b0161c; --brand-red-soft: #FBEAEA;
    --green: #46a929; --green-deep: #2f7318; --green-darker: #25610f;
    --amber: #D97706;
    --paper: #FBFAF7; --card: #FFFFFF; --ink: #2A2A26; --muted: #7A756C;
    --border: #E7E2D8; --error: #B4232A; --ok: #1E7A4C;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
       background: var(--paper); color: var(--ink); font-size: 15px; }
a { color: var(--brand-red); }

/* Display face for titles only — the data stays in the fast system sans. */
h1, h2, h3, .card h3 {
    font-family: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
    letter-spacing: -.01em;
}

/* Compact single-row header: Applewood brand, then channel columns (each
   heading directly above its pages), user chip on the right. No co-brand
   logo — it never sat right (Crew 2026-08-25). */
.topbar { display: flex; align-items: center; gap: 30px; padding: 8px 24px;
          background: var(--card); color: var(--ink); flex-wrap: wrap;
          border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; }
.brand-logo { display: block; height: 42px; width: auto; }
.topbar nav a { color: var(--ink); text-decoration: none; padding: 4px 12px;
                border-radius: 6px; font-size: 13.5px; opacity: .8; }
.topbar nav a:hover { background: var(--brand-red-soft); opacity: 1; }
.topbar nav a.active { background: var(--brand-red-soft); color: var(--brand-red-dark);
                       opacity: 1; font-weight: 600; }

.nav-groups { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.nav-group { display: flex; flex-direction: column; align-items: center;
             justify-content: center; gap: 2px; }
.nav-group + .nav-group { border-left: 1.5px solid #CFC7B5;
                          margin-left: 22px; padding-left: 22px; }
.nav-group-label { font-size: 9.5px; text-transform: uppercase;
                   letter-spacing: .11em; font-weight: 700; color: var(--muted);
                   white-space: nowrap; text-align: center; }
.nav-group-links { display: flex; gap: 2px; justify-content: center; }

.top-right { margin-left: auto; display: flex; align-items: center; }

/* User menu — a promoted, always-outlined chip opening a small dropdown. */
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 9px;
                     cursor: pointer; padding: 5px 12px 5px 6px; border-radius: 999px;
                     border: 1px solid var(--border); background: var(--paper); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary {
    background: var(--brand-red-soft); border-color: var(--brand-red-dark); }
.avatar { display: flex; align-items: center; justify-content: center;
          width: 30px; height: 30px; border-radius: 50%;
          background: var(--brand-red-soft); color: var(--brand-red-dark);
          font-size: 13.5px; font-weight: 700; }
.user-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.caret { font-size: 9px; color: var(--muted); }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
                 min-width: 200px; background: var(--card);
                 border: 1px solid var(--border); border-radius: 10px;
                 box-shadow: 0 6px 18px rgba(42, 42, 38, .09); overflow: hidden; }
.user-dropdown-head { padding: 11px 14px; font-size: 12.5px; color: var(--muted);
                      border-bottom: 1px solid var(--border); }
.user-dropdown-head b { color: var(--ink); }
.user-email { display: block; margin-top: 2px; font-size: 11.5px; }
.user-dropdown form { margin: 0; }
.user-dropdown-item { display: block; width: 100%; text-align: left; background: none;
                      border: 0; padding: 10px 14px; font-size: 13.5px; cursor: pointer;
                      color: var(--brand-red); font-family: inherit; }
.user-dropdown-item:hover { background: var(--brand-red-soft); }
a.user-dropdown-item { text-decoration: none; box-sizing: border-box; }
.linklike { background: none; border: 0; color: var(--brand-red); text-decoration: underline;
            cursor: pointer; font-size: 13px; margin-left: 8px; }

.page { max-width: 1180px; margin: 0 auto; padding: 26px 26px 60px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
             margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 700; }
.asof { margin-left: auto; font-size: 12.5px; color: var(--muted);
        display: flex; gap: 10px; align-items: center; }

/* The freshness pulse — inventory is produce; how current the numbers are
   IS the product. One quiet animated element, everywhere data is shown. */
.fresh { display: inline-flex; align-items: center; gap: 7px; }
.fresh-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
             box-shadow: 0 0 0 0 rgba(70, 169, 41, .45);
             animation: fresh-pulse 3s ease-out infinite; }
@keyframes fresh-pulse {
    0% { box-shadow: 0 0 0 0 rgba(70, 169, 41, .45); }
    70% { box-shadow: 0 0 0 7px rgba(70, 169, 41, 0); }
    100% { box-shadow: 0 0 0 0 rgba(70, 169, 41, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .fresh-dot { animation: none; }
}

.btn { display: inline-block; padding: 8px 16px; border-radius: 7px; font-size: 14px;
       border: 1px solid var(--border); background: var(--card); color: var(--ink);
       cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--green-deep); }
.btn-primary { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.btn-primary:hover { background: var(--green-darker); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 11px; font-size: 12.5px; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input[type=text] { flex: 1; min-width: 220px; }
input, select, textarea { padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-deep); outline-offset: 0; }

.tbl { width: 100%; border-collapse: collapse; background: var(--card);
       border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
       font-size: 13.5px; }
.tbl th { text-align: left; padding: 10px 12px; background: #F4EFE5;
          font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
          font-weight: 600; color: var(--muted);
          border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FBF9F4; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.qty-input { width: 84px; text-align: right; padding: 5px 8px; }
.addform { display: flex; gap: 6px; justify-content: flex-end; }
.agecell .age { display: inline-block; background: #F2EDE3; border-radius: 4px;
                padding: 1px 7px; font-size: 11px; margin: 1px 3px 1px 0; }

.st { display: inline-block; padding: 2px 10px; border-radius: 999px;
      font-size: 11.5px; font-weight: 600; background: #eee; }
.st-received, .st-needs_review { background: #FEF3C7; color: #92400E; }
.st-approved, .st-queued { background: #DBEAFE; color: #1E40AF; }
.st-pushed { background: #D1FAE5; color: #065F46; }
.st-rejected, .st-cancelled { background: #F3F4F6; color: #4B5563; }
.st-push_failed { background: #FEE2E2; color: #991B1B; }
.st-pending { background: #FEF3C7; color: #92400E; }
.st-denied { background: #FEE2E2; color: #991B1B; }

/* Users page (read-only directory + request-new-user) */
.users-grid { display: grid; grid-template-columns: 1fr 340px; gap: 26px; align-items: start; }
.sub-head { font-size: 16px; margin: 0 0 10px; }
.request-card { background: var(--card); border: 1px solid var(--border);
                border-radius: 12px; padding: 20px 22px; }
.request-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.request-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px;
                      color: var(--muted); }
.handoff { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.handoff-dismiss { display: inline; margin-left: auto; }
.temp-code { font-size: 14.5px; background: #fff; border: 1px solid var(--border);
             border-radius: 6px; padding: 3px 9px; user-select: all; }
.review-note { display: block; margin-top: 2px; font-size: 12px; }
@media (max-width: 860px) { .users-grid { grid-template-columns: 1fr; } }
.notedot { cursor: help; margin-left: 4px; }
.test-chip { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10px;
             font-weight: 700; background: #FEF3C7; color: #92400E; letter-spacing: .04em;
             vertical-align: middle; }

/* Marks items ordered before. The catalog already arrives most-ordered
   first, so this just explains why those rows are at the top. */
.freq-chip { color: #C58A16; font-size: 12px; margin-left: 3px; cursor: help; }

/* Order-channel chip in My Orders — both channels share one list. */
.type-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px;
             font-weight: 700; letter-spacing: .03em; vertical-align: middle; }
.type-finished_goods { background: var(--brand-red-soft); color: var(--brand-red-dark); }
.type-materials { background: #E7F5EC; color: #1F6B42; }

/* Materials category filter chips. The vocabulary comes from BelleHarvest,
   so this styles whatever labels arrive rather than a fixed set. */
/* Two labelled chip rows: item-group categories, then name-matched types. */
.chip-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.chip-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
              color: var(--muted); font-weight: 600; width: 62px; flex: 0 0 auto; padding-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12.5px;
        border: 1px solid var(--border); color: var(--muted); text-decoration: none;
        background: var(--card); }
.chip:hover { border-color: var(--brand-red); color: var(--brand-red-dark); }
.chip.on { background: var(--brand-red); border-color: var(--brand-red); color: #fff; font-weight: 600; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 12px; color: var(--muted); }

/* Packaging photos. Items with no picture in NetSuite show the Applewood
   logo, washed out so it reads as a placeholder, not a product photo. */
.thumbcell { width: 52px; }
.thumb { display: block; width: 44px; height: 44px; border-radius: 6px;
         object-fit: contain; background: #fff; border: 1px solid var(--border); }
.thumb-none { padding: 7px; box-sizing: border-box; opacity: 0.35;
              filter: grayscale(35%); }

.messages { margin-bottom: 12px; }

/* Raw Availability — per-variety supply cards with pure-CSS bar charts. */
.ra-intro { margin: 0 0 16px; }
.ra-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px;
           padding: 20px 22px; margin-bottom: 18px; }
.ra-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.ra-head h2 { margin: 0; font-size: 20px; }
.ra-kpis { display: flex; gap: 14px; margin-left: auto; }
.ra-kpi { font-size: 13px; color: var(--muted); }
.ra-kpi b { font-size: 16px; color: inherit; }
.ra-statuses { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.ra-body { display: grid; grid-template-columns: minmax(230px, 1fr) 2fr; gap: 26px; }
.ra-body--single { grid-template-columns: 1fr; }
.ra-body--single .ra-bars { max-width: 560px; }
.ra-col h3 { margin: 0 0 10px; font-size: 14px; }
.ra-bars { display: flex; flex-direction: column; gap: 5px; }
.ra-bar-row { display: flex; align-items: center; gap: 8px; }
.ra-bar-label { width: 44px; text-align: right; font-size: 12px; color: var(--muted);
                font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.ra-bar-track { flex: 1; height: 14px; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.ra-bar-fill { display: block; height: 100%; background: var(--green-deep, #2F6B4F);
               border-radius: 4px; }
.ra-fit-fill { background: var(--brand-red, #B33A3A); opacity: 0.75; }
.ra-bar-val { width: 46px; font-size: 12px; color: var(--muted);
              font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.ra-band { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ra-fit { min-width: 160px; }
.ra-fit .ra-bar-track { display: inline-block; width: 90px; vertical-align: middle; }
.ra-fit .ra-bar-val { display: inline-block; margin-left: 6px; }
.ra-note { font-size: 12px; margin-top: 8px; }
@media (max-width: 860px) { .ra-body { grid-template-columns: 1fr; } }
.msg { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 8px; }
.msg-success { background: #D1FAE5; color: #065F46; }
.msg-error { background: #FEE2E2; color: #991B1B; }
.msg-info { background: #E0EAFF; color: #273E8A; }

.empty { padding: 40px; text-align: center; color: var(--muted);
         background: var(--card); border: 1px dashed var(--border); border-radius: 10px; }
.muted { color: var(--muted); font-size: 13px; }

/* Order review: lines on the left, a checkout rail on the right. The rail
   holds everything needed to finish — totals, details, the submit — so the
   eye never has to hunt below a table for loose fields. */
.order-grid { display: grid; grid-template-columns: 1fr 330px; gap: 18px;
              align-items: start; }
.order-rail { position: sticky; top: 18px; display: flex; flex-direction: column;
              gap: 0; }
.rail-totals { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px;
               padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.rail-row { display: flex; justify-content: space-between; font-size: 13.5px;
            color: var(--muted); }
.rail-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rail-row.rail-em { font-size: 15px; }
.rail-row.rail-em b { font-size: 17px; }
.order-rail label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px;
                    color: var(--muted); margin-bottom: 12px; }
.order-rail textarea { resize: vertical; }
.order-rail .btn-primary { width: 100%; padding: 11px 16px; font-size: 15px;
                           margin-top: 4px; }
.rail-back { display: block; text-align: center; margin-top: 10px; font-size: 13px;
             color: var(--muted); }
.remove-x { background: none; border: 0; color: var(--muted); font-size: 15px;
            cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1; }
.remove-x:hover { color: var(--brand-red); background: var(--brand-red-soft); }

@media (max-width: 860px) {
    .order-grid { grid-template-columns: 1fr; }
    .order-rail { position: static; }
}

.detail-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px;
        padding: 16px 18px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.login-card { max-width: 380px; margin: 9vh auto; background: var(--card);
              border: 1px solid var(--border); border-radius: 12px; padding: 30px 32px;
              text-align: center; }
.login-logo { display: block; width: 190px; margin: 4px auto 10px; }
.login-card form { text-align: left; }
.login-partner { display: flex; align-items: center; justify-content: center; gap: 9px;
                 margin-top: 22px; font-size: 11px; color: var(--muted);
                 text-transform: uppercase; letter-spacing: .05em; }
.login-partner img { height: 24px; width: auto; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px;
                    color: var(--muted); }

@media (max-width: 860px) {
    .detail-grid { grid-template-columns: 1fr; }
    .page { padding: 16px 14px 50px; }
    .tbl { display: block; overflow-x: auto; }
    .topbar { padding: 8px 14px; gap: 16px; }
    .brand-logo { height: 36px; }
    .nav-groups { row-gap: 8px; }
    .nav-group + .nav-group { border-left: 0; margin-left: 12px; padding-left: 0; }
    .user-name { display: none; }         /* chip collapses to the avatar */
}

/* Raw availability: selectable size rows + per-size est. cases */
.ra-bar-row--pick { cursor: pointer; }
.ra-bar-row--pick:hover .ra-bar-label { color: var(--ink); }
.ra-size-pick { accent-color: var(--green-deep, #2f6b3a); margin: 0; flex: 0 0 auto; }
.ra-bar-cases { width: 92px; text-align: right; font-size: 12px; color: var(--ink);
    font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.ra-select-note { margin-top: 10px; padding: 8px 12px; border-radius: 8px;
    background: var(--card, #fff); border: 1px solid var(--green-deep, #2f6b3a);
    font-size: 13px; }
.ra-select-note b { font-variant-numeric: tabular-nums; }
