/* ==========================================================================
 * Event Studio - Vendors > Applications (Milestone H)
 *
 * views/vendor-applications.js (st-vapp, -stats, -toolbar, -table, -biz,
 * -money, the drawer: -drawer, -sec, -card, -links, -offer, -photos,
 * -answers, -timeline) and its dialogs, ui/vendor-app-dialogs.js
 * (-dialog, -bullets, -assign, -spot). The tier dot and chip and the status
 * are css/vendor-host.css; the Assign spot dialog lays out like the area
 * picker of spot bidding (css/spot-bidding.css, st-spot-pick). Colours are
 * the kit's tokens; a tier's colour comes from the data as an inline style.
 * Nothing here moves.
 * ========================================================================== */

/* ---------- the tab ---------- */
.st-vapp { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.st-vapp-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* With the Vendor fees tile (only where there is a fee): six in a row; the narrower layouts below keep their columns. */
.st-vapp-stats--fees { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.st-vapp-stats .st-stat__hint { line-height: 1.35; }
.st-vapp-attention:empty { display: none; }

.st-vapp-toolbar { margin-bottom: 12px; }
.st-vapp-toolbar .st-toolbar { margin-bottom: 8px; min-height: 38px; }
.st-vapp-toolbar .st-toolbar:last-child { margin-bottom: 0; }
.st-vapp-toolbar .st-search { flex: 0 1 320px; }
.st-vapp-tierfilter { width: auto; min-width: 150px; max-width: 220px; }

/* ---------- the table ---------- */
/* Fixed layout: a long business name is cut with an ellipsis instead of
   pushing the other columns out; a narrow window scrolls the table sideways. */
.st-vapp-table .st-table__table { table-layout: fixed; min-width: 1100px; }
.st-vapp-table .st-table__table td { overflow: hidden; height: 52px; }
/* Inside a fixed column a long text ends with an ellipsis instead of being cut by the cell. */
.st-vapp-table td .st-truncate { display: block; }
.st-vapp-table td .st-vh-status, .st-vapp-table td .st-vh-tier { display: flex; }
/* The line under the status takes up to two lines, so "Area removed - assign another spot" and a
   deadline with its time are read in full; only a long decline reason ends in an ellipsis. */
.st-vapp-table td .st-vh-status__detail {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  white-space: normal; overflow: hidden; line-height: 1.3;
}

.st-vapp-biz { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-vapp-biz__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.st-vapp-biz__name { font-weight: 600; }
.st-vapp-biz__sub { font-size: 12.5px; color: var(--st-text-muted); }

.st-vapp-spotcell { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; color: var(--st-text-dim); }
.st-vapp-spotcell .st-icon { flex: 0 0 auto; color: var(--st-green); }
.st-vapp-nospot { color: #fcd34d; white-space: nowrap; }
/* A spot whose area was removed from the venue map: the old name struck through, and what to do. */
.st-vapp-spotgone { display: inline-flex; flex-direction: column; gap: 1px; max-width: 100%; line-height: 1.3; }
.st-vapp-spotgone__old { color: var(--st-text-muted); }
.st-vapp-spotgone .st-vapp-nospot { font-size: 12.5px; }
.st-vapp-assign__gone { margin: 0; }

.st-vapp-money { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.3; }
.st-vapp-money__sub { color: var(--st-text-muted); white-space: nowrap; }
.st-vapp-money__sub.is-warn { color: #fcd34d; }

.st-vapp-selection__note { white-space: nowrap; }
.st-vapp-notice .st-empty { padding-top: 40px; padding-bottom: 40px; }

/* ---------- the drawer ---------- */
.st-vapp-drawer { display: flex; flex-direction: column; min-width: 0; }
/* Each part of the drawer sits in its own slot (redrawn alone); the slot itself draws nothing. */
.st-vapp-part { display: contents; }
.st-vapp-drawer > .st-callout, .st-vapp-part > .st-callout { margin-bottom: 4px; }
.st-vapp-sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--st-border); }
.st-vapp-drawer > .st-vapp-sec:first-child,
.st-vapp-part:first-child:empty + .st-vapp-part > .st-vapp-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.st-vapp-sec__head { display: flex; flex-direction: column; gap: 2px; }
.st-vapp-sec__title { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.35; }
.st-vapp-sec__hint { font-size: 12.5px; line-height: 1.45; color: var(--st-text-muted); }
.st-vapp-sec .st-kv__row:first-child { padding-top: 0; }

/* What a vendor typed: shown as text, line breaks kept, never wider than the panel. */
.st-vapp-text { font-size: 13.5px; line-height: 1.55; color: var(--st-text-dim); white-space: pre-line; overflow-wrap: anywhere; }

.st-vapp-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--st-border); border-radius: var(--st-r-12); background: var(--st-bg-elev); min-width: 0; }
.st-vapp-card__head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.st-vapp-card__titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.st-vapp-card__name { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.st-vapp-card .st-kv__row { padding: 7px 0; }

.st-vapp-links { display: flex; flex-wrap: wrap; gap: 6px; }
.st-vapp-link {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--st-text-dim); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--st-border-strong);
}
.st-vapp-link:hover { color: var(--st-text); border-color: rgba(124, 92, 255, 0.6); }
.st-vapp-broken { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--st-amber); }
.st-vapp-broken li { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.st-vapp-broken .st-icon { flex: 0 0 auto; align-self: center; }
.st-vapp-broken span { flex: 0 0 auto; }
.st-vapp-broken__value { flex: 1 1 auto !important; min-width: 0; color: var(--st-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.st-vapp-offer { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--st-r-10); border: 1px dashed var(--st-border-strong); min-width: 0; }
.st-vapp-offer__tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--st-text-muted); }
.st-vapp-offer__title { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.st-vapp-offer__details { font-size: 12.5px; color: var(--st-text-dim); overflow-wrap: anywhere; }
.st-vapp-offer__code { font-size: 12.5px; color: var(--st-lavender); }

.st-vapp-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.st-vapp-photo { display: block; aspect-ratio: 1 / 1; border-radius: var(--st-r-10); overflow: hidden; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--st-border); }
.st-vapp-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.st-vapp-tierline { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.st-vapp-quote { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-left: 3px solid var(--st-border-strong); background: rgba(255, 255, 255, 0.03); border-radius: 0 var(--st-r-8) var(--st-r-8) 0; }
.st-vapp-quote__label, .st-vapp-answers dt { font-size: 12.5px; font-weight: 500; color: var(--st-text-muted); }
.st-vapp-answers { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.st-vapp-answers > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-vapp-answers dd { margin: 0; color: var(--st-text); }

.st-vapp-timeline { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.st-vapp-timeline li { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 0 0 14px 18px; min-width: 0; }
.st-vapp-timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--st-violet-2); }
.st-vapp-timeline li::after { content: ""; position: absolute; left: 3px; top: 17px; bottom: 0; width: 1px; background: var(--st-border-strong); }
.st-vapp-timeline li:last-child { padding-bottom: 0; }
.st-vapp-timeline li:last-child::after { display: none; }
.st-vapp-timeline__what { font-size: 13.5px; font-weight: 600; }
.st-vapp-timeline__detail { font-size: 13px; color: var(--st-text-dim); overflow-wrap: anywhere; }

/* The footer holds up to five actions: let them wrap instead of leaving the panel. */
.st-vapp-drawer-dialog .st-dialog__footer { flex-wrap: wrap; row-gap: 8px; }
.st-vapp-drawer-dialog .st-dialog__footer-end { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- the dialogs ---------- */
.st-vapp-days { max-width: 120px; }
.st-vapp-bullets { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 18px; list-style: disc; font-size: 13.5px; line-height: 1.5; color: var(--st-text-dim); }

.st-vapp-assign .st-spot-pick__side { gap: 10px; }
.st-vapp-assign__list { flex: 1 1 auto; min-height: 0; max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 12px; border: 1px solid var(--st-border); border-radius: var(--st-r-10); }
.st-vapp-assign__group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.st-vapp-assign__tier { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 600; }
.st-vapp-assign__free { margin-left: auto; font-weight: 400; white-space: nowrap; }
.st-vapp-assign__spots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.st-vapp-assign__picked { min-height: 38px; margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--st-text-dim); }

.st-vapp-spot {
  display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0; min-height: 36px; padding: 6px 10px; text-align: left;
  font: inherit; font-size: 13px; color: var(--st-text); border-radius: var(--st-r-8); cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--st-border-strong);
}
.st-vapp-spot:hover:not(:disabled) { border-color: rgba(124, 92, 255, 0.7); }
.st-vapp-spot.is-picked { background: rgba(109, 92, 255, 0.2); border-color: var(--st-violet-2); box-shadow: inset 0 0 0 1px var(--st-violet-2); }
.st-vapp-spot:disabled { cursor: default; color: var(--st-text-muted); background: transparent; border-style: dashed; }
.st-vapp-spot.is-current:disabled { color: var(--st-text); border-style: solid; border-color: rgba(52, 211, 153, 0.5); }
.st-vapp-spot__label { flex: 0 0 auto; font-weight: 600; }
.st-vapp-spot__size { flex: 0 0 auto; font-size: 12px; color: var(--st-text-muted); }
.st-vapp-spot__who { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--st-text-muted); text-align: right; }
.st-vapp-spot__who.is-current { color: var(--st-green); white-space: nowrap; }

@media (max-width: 1180px) {
  .st-vapp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .st-vapp-assign.st-spot-pick { grid-template-columns: 1fr; }
  .st-vapp-assign__list { max-height: 240px; }
}
@media (max-width: 640px) {
  .st-vapp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-vapp-assign__spots { grid-template-columns: 1fr; }
}

/* ---------- what the team has to look at (a failed refund, a dispute) ---------- */
.st-vapp-attn { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.st-vapp-attn > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.st-vapp-attn__links { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; }
.st-vapp-attn__links .st-link { font-size: inherit; }

/* ---------- second review round: a place in another tier, a refund that is owed ---------- */
.st-vapp-tiercell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; max-width: 100%; }
.st-vapp-tiercell__place { max-width: 100%; }
.st-vapp-owed { color: var(--st-amber); }


/* The refunds of a registration with the team's reasons (the drawer's Money part). */
.st-vapp-refunds { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.st-vapp-refunds__label { font-size: 12px; font-weight: 600; color: var(--st-text-muted); }
.st-vapp-refunds__list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.st-vapp-refunds__list > li { display: flex; align-items: baseline; gap: 12px; padding: 8px 10px; border: 1px solid var(--st-border); border-radius: var(--st-r-10); }
.st-vapp-refunds__amount { flex: 0 0 auto; font-weight: 600; }
.st-vapp-refunds__what { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
