/* ============================================================
   SCT Nexus — Field module UI (responsive)
   Dedicated stylesheet for the store list (fxl-) and the visit
   console (fx-). Works on phone, iPad/tablet and desktop.
   Loaded via <link> in App.razor — no appends needed.
   ============================================================ */

/* Centered, capped content column so field pages look good on a
   big desktop screen (not stretched) while staying full-width on
   phones. Each block centers itself; on phones max-width > viewport
   so it just fills the screen. */
/* Visit console uses the full application content width, matching Order. */
.fx-head, .fx-tabs, .fx-card, .fx-quick, .fx-toast {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* The store directory remains intentionally capped for readable cards. */
.fxl-head, .fxl-search, .fxl-filters, .fxl-list, .fxl-empty, .fxl-none {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Store list ---------- */
.fxl-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.fxl-title { font-size: 24px; font-weight: 800; color: #1F3864; }
.fxl-sub { font-size: 13px; color: #6b7280; }

.fxl-search { position: relative; margin-bottom: 10px; }
.fxl-search .fx-in { margin: 0; padding-right: 42px; }
.fxl-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: #eef0f4; color: #555; width: 32px; height: 32px; border-radius: 50%;
  font-size: 15px; cursor: pointer; }

.fxl-filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.fxl-filters button { flex: 0 0 auto; border: 1px solid #d7deea; background: #fff; color: #1F3864;
  padding: 9px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.fxl-filters button.on { background: #1F3864; color: #fff; border-color: #1F3864; }

.fxl-list { display: flex; flex-direction: column; gap: 10px; }
/* On wide screens, show store cards two-up to use the space well */
@media (min-width: 900px) {
  .fxl-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}
.fxl-card { display: flex; align-items: stretch; background: #fff; border: 1px solid #e3e7ee;
  border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .12s, transform .05s; }
.fxl-card:active { transform: scale(.995); }
.fxl-card:hover { box-shadow: 0 4px 14px rgba(31,56,100,.10); }
.fxl-bar { width: 6px; flex: 0 0 6px; }
.fxl-body { flex: 1; min-width: 0; padding: 14px; }
.fxl-name { font-weight: 800; font-size: 17px; color: #1F3864; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxl-meta { font-size: 13px; color: #6b7280; margin-top: 3px; display: flex; align-items: center; gap: 8px; }
.fxl-issues { background: #fdecea; color: #a12a20; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.fxl-right { display: flex; align-items: center; gap: 8px; padding: 0 14px; }
.fxl-score { min-width: 42px; text-align: center; color: #fff; font-weight: 800; font-size: 15px; padding: 7px 9px; border-radius: 999px; }
.fxl-chev { color: #c3cbd8; font-size: 26px; line-height: 1; }
.fxl-empty { text-align: center; padding: 48px 16px; }
.fxl-none { text-align: center; padding: 28px; color: #6b7280; }

/* ---------- Visit console ---------- */
.fx-loading { padding: 28px; text-align: center; color: #6b7280; }
.fx-muted { color: #6b7280; font-size: 14px; }
.fx-hint { color: #9aa3b2; font-size: 13px; margin-top: 8px; }

/* Sticky store header — bleeds to the edges on phone, capped on desktop */
.fx-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: #1F3864; color: #fff;
  padding: 14px 16px; border-radius: 0 0 14px 14px; margin-bottom: 14px;
}
.fx-back { color: #fff; text-decoration: none; font-size: 24px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.fx-back:hover { background: rgba(255,255,255,.12); }
.fx-head-main { flex: 1; min-width: 0; }
.fx-head-name { font-weight: 800; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-head-sub { font-size: 12px; color: #b9c4dc; }
.fx-health { min-width: 44px; text-align: center; font-weight: 800; color: #fff; padding: 7px 12px; border-radius: 999px; font-size: 16px; }

/* Tab switcher */
.fx-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.fx-tabs button { border: 1px solid #d7deea; background: #fff; color: #1F3864;
  padding: 13px 6px; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.fx-tabs button.on { background: #1F3864; color: #fff; border-color: #1F3864; }

/* Cards */
.fx-card { background: #fff; border: 1px solid #e3e7ee; border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.fx-card h3 { margin: 0 0 14px; color: var(--nexus-accent, #EE7326); font-size: 17px; }

/* Inputs / buttons — 16px avoids iOS zoom-on-focus */
.fx-in { width: 100%; padding: 14px; border: 1px solid #cbd2dd; border-radius: 12px; font-size: 16px; margin-bottom: 12px; }
.fx-btn { border: 0; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; }
.fx-btn.primary { background: var(--nexus-accent, #EE7326); color: #fff; }
.fx-btn.primary:disabled { background: #f0b489; }
.fx-btn.big { width: 100%; padding: 16px; margin-top: 6px; }

/* Photo capture — stacked rows with clear state */
.fx-photo { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px dashed #cbd2dd; border-radius: 12px; padding: 14px; margin-bottom: 12px; font-size: 15px; color: #1F3864; font-weight: 600; }
.fx-photo input[type=file] { max-width: 55%; }
.fx-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.fx-thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid #e3e7ee; }
img.mini { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }

/* Severity segmented control */
.fx-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.fx-seg button { border: 1px solid #cbd2dd; background: #fff; color: #333; padding: 13px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; }
.fx-seg button.on { color: #fff; border-color: transparent; }
.fx-seg button.on.sev-low { background: #7f8c8d; }
.fx-seg button.on.sev-medium { background: #d9902b; }
.fx-seg button.on.sev-high { background: #c0392b; }

/* Issues list */
.fx-issues { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fx-issues li { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid #eef0f4; border-radius: 12px; background: #fafbfc; }
.fx-issues li.done {
    opacity: 1;
    background: #f8fafc;
    border-color: #d8e1eb;
}
.fx-issues li.done .ti strong { color: #40516b; }
.fx-issues li.done .ti small { color: #68768a; }
.fx-issues li.done .mini { opacity: 1; }
.fx-issues li.done .st {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    color: #1e6b3a;
    background: #e7f6ec;
    border-radius: 999px;
}
.fx-issues .ti { flex: 1; font-size: 15px; }
.fx-issues .st { color: #2e9e5b; font-weight: 800; }
.sev { font-size: 11px; font-weight: 800; color: #fff; padding: 3px 9px; border-radius: 999px; }
.sev-low { background: #7f8c8d; } .sev-medium { background: #d9902b; } .sev-high { background: #c0392b; }
.fx-resolve { border: 0; background: #eef4ff; color: #1F3864; font-weight: 700; padding: 9px 14px; border-radius: 10px; cursor: pointer; }

/* Inline order pad */
.fx-order { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.fx-order li { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #eef0f4; border-radius: 12px; background: #fafbfc; }
.ol-info { flex: 1; min-width: 0; }
.ol-code { font-weight: 800; color: #1F3864; font-size: 13px; }
.ol-desc { font-size: 14px; }
.ol-meta { font-size: 12px; color: #888; }
.ol-qty { display: flex; align-items: center; gap: 8px; }
.ol-qty button { width: 42px; height: 42px; border: 1px solid #cbd2dd; background: #fff; border-radius: 12px; font-size: 22px; font-weight: 700; cursor: pointer; }
.ol-qty input { width: 60px; text-align: center; padding: 11px 4px; border: 1px solid #cbd2dd; border-radius: 12px; font-size: 16px; }
.fx-total { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 0; font-size: 17px; }

/* Health quick strip */
.fx-quick { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 2px; }
.fx-band { color: #fff; font-weight: 800; padding: 7px 14px; border-radius: 999px; font-size: 14px; }
.fx-band.sm { font-size: 12px; padding: 3px 9px; }

/* Visit history */
.fx-hist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.fx-hist li { border: 1px solid #eef0f4; border-radius: 12px; background: #fafbfc; padding: 13px; }
.fx-hist .hh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fx-hist .hd { font-weight: 700; color: #1F3864; }
.fx-hist .hm { color: #888; font-size: 12px; margin-top: 4px; }

/* Toasts + inline errors */
.fx-toast { width: 100%; max-width: none; margin: 0 0 14px; padding: 13px 15px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.fx-toast.ok { background: #e7f6ec; border: 1px solid #b9e2c6; color: #1e6b3a; }
.fx-toast.err { background: #fdecea; border: 1px solid #f5c6c2; color: #a12a20; }
.fx-inline-err { color: #a12a20; font-size: 14px; margin-top: 8px; }

/* ---------- Responsive layout: sidebar collapses on phones ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; }
  .sidebar .brand { font-size: 16px; margin: 0; }
  .sidebar .tenant { margin: 0 6px 0 0; font-size: 12px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; width: 100%; }
  .sidebar nav a { padding: 8px 10px; font-size: 14px; }
  .sidebar .role { margin: 0; width: 100%; display: flex; align-items: center; gap: 8px; }
  .sidebar .role .who, .sidebar .role .who-role { display: none; }
  .content { padding: 12px; }
  .fx-head { border-radius: 0; margin: -12px -12px 14px; }
}

/* Department selector for one-department-per-order */
.fx-order-department { display: grid; gap: 6px; margin-bottom: 14px; }
.fx-order-department span { color: #1F3864; font-size: 13px; font-weight: 800; }
.fx-order-department select { width: 100%; padding: 14px; border: 1px solid #cbd2dd; border-radius: 12px; background: #fff; color: #1F3864; font-size: 16px; }


/* Phase 2 catalogue tools */
.fx-catalogue-tools { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; margin-bottom: 8px; }
.fx-catalogue-tools .fx-in { margin: 0; }
.fx-suggested { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: #e7f6ec; color: #1e6b3a; font-size: 11px; font-weight: 800; }
@media (max-width: 600px) { .fx-catalogue-tools { grid-template-columns: 1fr; } }


/* Phase 3 usage and availability */
.availability { display: inline-block; margin-top: 5px; padding: 3px 9px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 800; }
.availability-good { background: #27864b; }
.availability-low { background: #d9902b; }
.availability-insufficient { background: #d95f2b; }
.availability-out { background: #b42b2b; }
.availability-unknown { background: #7f8c8d; }
.ol-qty button:disabled, .ol-qty input:disabled { opacity: .45; cursor: not-allowed; }

/* Availability and suggestion badges */
.fx-product-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.fx-availability {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.fx-availability-good {
  background: #e7f6ec;
  color: #1e6b3a;
  border: 1px solid #b9e2c6;
}

.fx-availability-low {
  background: #fff4d8;
  color: #8a5b00;
  border: 1px solid #f0d48a;
}

.fx-availability-insufficient {
  background: #fde8d8;
  color: #a84a00;
  border: 1px solid #f3bd96;
}

.fx-availability-outofstock {
  background: #fdecea;
  color: #a12a20;
  border: 1px solid #f5c6c2;
}

.fx-availability-unknown {
  background: #eef0f4;
  color: #596273;
  border: 1px solid #d5dae3;
}

.fx-suggested {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eaf0ff;
  color: #285693;
  border: 1px solid #c9d7f5;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

/* FIELD CONSOLE WIDE WORKSPACE - AUTHORITATIVE */

/*
 * Visit, Issues, Order and History must fill the same application
 * content area. The Field store directory remains independently sized.
 */
body .content .fx-head,
body .content .fx-tabs,
body .content .fx-card,
body .content .fx-quick,
body .content .fx-toast,
body .content .oc-shell {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body .content .fx-tabs {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 8px !important;
}

body .content .fx-tabs > button {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

body .content .oc-card {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* Phase 4L.2 visit evidence */
.fx-evidence{display:grid;gap:6px;margin:12px 0;padding:12px;background:#f5f8fb;border-radius:11px}.fx-evidence strong{color:#1f3864}.fx-evidence span,.fx-history-evidence{color:#68768a;font-size:12px}.fx-history-evidence{margin-top:6px}


/* Phase 4L.2A location details */
.fx-location-list {
    display: grid;
    gap: 9px;
    margin-top: 9px;
}

.fx-location-item {
    padding: 11px 12px;
    background: #ffffff;
    border: 1px solid #dce4ee;
    border-radius: 10px;
}

.fx-location-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fx-location-summary strong,
.fx-location-summary span {
    display: block;
}

.fx-location-summary strong {
    color: #1f3864;
}

.fx-location-summary span,
.fx-location-empty {
    margin-top: 3px;
    color: #68768a;
    font-size: 12px;
}

.fx-map-link {
    flex: 0 0 auto;
    padding: 7px 10px;
    color: #ffffff;
    background: #1f3864;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.fx-location-details {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid #edf1f5;
}

.fx-location-details summary {
    width: max-content;
    color: #1f3864;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.fx-location-details dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 14px;
    margin: 10px 0 0;
}

.fx-location-details dl > div {
    min-width: 0;
}

.fx-location-details dt {
    color: #7a8493;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.fx-location-details dd {
    margin: 2px 0 0;
    color: #243854;
    overflow-wrap: anywhere;
}

.fx-location-reason {
    grid-column: 1 / -1;
}

.fx-history-evidence .fx-location-item {
    margin-top: 7px;
}

@media (max-width: 600px) {
    .fx-location-summary {
        align-items: flex-start;
    }

    .fx-location-details dl {
        grid-template-columns: 1fr;
    }

    .fx-location-reason {
        grid-column: auto;
    }
}

/* Phase 4L.2B connectivity */
.fx-connectivity{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px;padding:10px 13px;border:1px solid #cfe2d5;border-radius:11px;background:#eef8f1}.fx-connectivity strong{color:#1e6b3a}.fx-connectivity span{color:#64748b;font-size:12px}.fx-connectivity.offline{border-color:#efcf8c;background:#fff7df}.fx-connectivity.offline strong{color:#8a5b00}@media(max-width:600px){.fx-connectivity{display:grid}}


/* Dual camera and gallery controls */
.fx-photo-group {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.fx-photo-heading {
    color: #1f3864;
    font-weight: 800;
}

.fx-photo-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.fx-photo-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    text-align: center;
}

.fx-photo-button.camera {
    color: #ffffff;
    background: #1f3864;
    border-color: #1f3864;
}

.fx-photo-button.choose {
    color: #1f3864;
    background: #ffffff;
}

.fx-photo-button input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 520px) {
    .fx-photo-actions {
        grid-template-columns: 1fr;
    }
}


/* Embedded cross-platform camera */
.fx-camera-host { display: contents; }
.fx-camera-output { position:absolute!important; width:1px!important; height:1px!important; opacity:0!important; overflow:hidden!important; }
.fx-camera-backdrop { position:fixed; inset:0; z-index:5000; display:grid; place-items:center; padding:18px; background:rgba(8,20,38,.82); }
.fx-camera-dialog { width:min(760px,100%); padding:14px; background:#fff; border-radius:16px; box-shadow:0 24px 70px rgba(0,0,0,.35); }
.fx-camera-dialog video { display:block; width:100%; max-height:68vh; object-fit:contain; background:#080d15; border-radius:11px; }
.fx-camera-dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:12px; }
@media(max-width:520px){.fx-camera-dialog-actions{display:grid;grid-template-columns:1fr 1fr}.fx-camera-dialog-actions .fx-btn{width:100%}}


/* Phase 4M.1 issue evidence */
.fx-issue-classification{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.fx-issue-classification label{display:grid;gap:5px;color:#1f3864;font-size:13px;font-weight:800}.fx-issues .ti{display:grid;gap:3px}.fx-issues .ti small{color:#68768a;font-size:11px;font-weight:600}.fx-resolution-card{display:grid;gap:10px;margin-top:14px;padding:14px;border:1px solid #f0c49f;border-radius:12px;background:#fff8f2}.fx-resolution-card>strong{color:#1f3864}.fx-resolution-actions{display:flex;justify-content:flex-end;gap:8px}.fx-resolution-actions .fx-btn{padding:11px 15px}@media(max-width:600px){.fx-issue-classification{grid-template-columns:1fr}.fx-resolution-actions{display:grid;grid-template-columns:1fr 1fr}.fx-issues li{align-items:flex-start;flex-wrap:wrap}.fx-issues .ti{min-width:55%}}

/* Phase 4M after-photo panel placement */
.fx-resolution-card {
    margin: 0 0 16px;
    border: 2px solid #2c73d2;
    box-shadow: 0 8px 24px rgba(31, 56, 100, .10);
}
