/*
 * UI sweep (site-wide, loaded last on the nb layout). Shared fixes, not page tweaks:
 *  - selects: one look, like the inputs - custom chevron, no browser arrow, long text ellipsised
 *  - stat tiles (<x-nb.stat-card>, all KPI rows): auto-fit grid, amounts never overflow
 *  - text in flex / grid rows can shrink (min-width:0); long words wrap
 *  - buttons next to inputs match the input height; icons line up with their text
 */

/* ---- selects (native). Not list boxes (size > 1) or multi-selects. */
.nb select:not([multiple]):not([size]), .nb select[size="1"], .nb .po-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  height: var(--h-field, 44px); padding: 0 40px 0 14px !important;
  border: 1px solid var(--line); border-radius: var(--r-field, 12px); background-color: var(--surface, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23403E3A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
  color: var(--ink); font: inherit; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; min-width: 0; max-width: 100%;
}
.nb select::-ms-expand { display: none; }
.nb select:focus-visible { outline: 2px solid var(--ring-c, var(--acc-d)); outline-offset: -1px; border-color: var(--ring-c, var(--acc-d)); }
.nb select:disabled { opacity: .6; cursor: not-allowed; }
/* a select that is a SEGMENT of a bar is flat like the segments beside it, not a boxed field inside
   the bar: the header search's "Any date" sat in a white 12px box next to the flat "Nashik".
   Chevron kept (like the city's); :not(#nb-ui) lifts this over the rule above (and its !important padding). */
.nb .tb-search__when select:not(#nb-ui) {
  height: 44px; padding: 0 22px 0 0 !important; border: 0; border-radius: 0; background-color: transparent;
  background-position: right 0 center; font: 500 15px/1 var(--ff); box-shadow: none;
  field-sizing: content; /* as wide as the chosen option, so the chevron sits by the text like the city's (Chromium; others: widest option) */
}

/* ---- stat tiles: one grid everywhere. Amounts: clamp size, tabular, never wrap; the tile grows instead.
   :not(#nb-ui) lifts these over the older per-page tile rules (nb-portal / nb-orders / nb-extensions). */
.nb :is(.stats-row, .ord-tiles):not(#nb-ui) { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.nb :is(.stats-row, .ord-tiles):not(#nb-ui) > * { min-width: 0; }
.nb .stat-card:not(#nb-ui) strong {
  font-size: clamp(18px, 2.2vw, 26px); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: visible; line-height: 1.15;
}
/* a long amount (₹1,23,45,678.90): DM Sans 700 and a smaller clamp - Unbounded is too wide for a tile */
.nb .stat-card:not(#nb-ui) strong.is-long { font-family: var(--ff, 'DM Sans', sans-serif); font-weight: 700; letter-spacing: -.01em; font-size: clamp(16px, 1.45vw, 21px); }
.nb .stat-card .stat-label, .nb .stat-card .stat-meta { white-space: normal; overflow-wrap: anywhere; }
.nb .stat-card { overflow: visible; }
@media (max-width: 767.98px) {
  /* phones keep the swipeable row (an intended scroller) - tiles are as wide as their number needs */
  .nb .stats-row:not(#nb-ui) { display: flex; }
  .nb .stats-row:not(#nb-ui) > * { flex: 0 0 auto; min-width: min(72%, 220px); }
  /* Contact details (nb-mobile.css .contact-info-row): stacked cards, every one visible - not a swipe row */
  .nb .stats-row.contact-info-row:not(#nb-ui) { display: grid; grid-template-columns: 1fr; overflow: visible; }
  .nb .stats-row.contact-info-row:not(#nb-ui) > * { min-width: 0; }
  .nb .ord-tiles:not(#nb-ui) { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* ---- text in rows can shrink; long names / venues / emails wrap instead of pushing the layout */
.nb .row-title, .nb .row-sub, .nb .bk__title, .nb .ev-card__title, .nb .ev-card__venue, .nb .mrow__name, .nb .mrow__sub, .nb .stat-label { min-width: 0; overflow-wrap: anywhere; }
.nb .list-row > *, .nb .fields > *, .nb .field { min-width: 0; }

/* ---- buttons beside inputs: the input's height */
.nb .field-actions .btn, .nb .ew-dup__row .btn, .nb .kit-find .btn, .nb .cpn-code-in .btn, .nb .pt .btn { min-height: var(--h-field, 44px); }

/* ---- icons: inline-flex wrappers keep them centred on their text */
.nb .btn, .nb .text-link, .nb .status-badge, .nb .chip, .nb .tab { align-items: center; }
.nb .btn > svg, .nb .text-link > svg, .nb .tab > svg { flex: none; vertical-align: middle; }

/* ---- 1. wizard "Copy a past event": icon + text on one line, select and button the same height, stacked on phones */
.nb .ew-dup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; overflow: visible; }
.nb .ew-dup__head { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.nb .ew-dup__head > svg { flex: none; width: 18px; height: 18px; margin: 0; color: var(--ink-2); }
.nb .ew-dup__head label { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.nb .ew-dup__row { display: flex; align-items: stretch; gap: 8px; flex-wrap: nowrap; }
.nb .ew-dup__row select { flex: 1 1 auto; min-width: 0; height: var(--h-field, 48px); }
.nb .ew-dup__row .btn { flex: none; height: var(--h-field, 48px); }
@media (max-width: 575.98px) {
  .nb .ew-dup__row { flex-direction: column; }
  .nb .ew-dup__row select, .nb .ew-dup__row .btn { width: 100%; justify-content: center; }
}

/* ---- 3. "Switch event" / dropdown panels: on top of the page (below the header), scroll inside */
.nb .evs__panel { overscroll-behavior: contain; }
.nb .evs__opt:focus-visible { outline: 2px solid var(--acc-d); outline-offset: -2px; }

/* ---- per-event orders header: a long event name gets the full width under the back link and
   the actions, instead of a narrow column beside them (9 lines of Unbounded) */
@media (min-width: 768px) {
  .nb .evh2 { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "back actions" "title title" "meta meta" "fee fee"; column-gap: 16px; align-items: center; }
  .nb .evh2__main { display: contents; }
  .nb .evh2__back { grid-area: back; justify-self: start; }
  .nb .evh2__title { grid-area: title; margin-top: 10px; }
  .nb .evh2__meta { grid-area: meta; }
  .nb .evh2__fee { grid-area: fee; }
  .nb .evh2__actions { grid-area: actions; justify-content: flex-end; }
}

/* ---- long names and big amounts (found by tests/ui/css-sweep with seeded long data) */
/* customer dashboard: "Hi, Venkatanarasimharajuvaripeta" made the page 735px wide on a phone */
.nb .dsh-hello > div { min-width: 0; flex: 1 1 260px; }
.nb .dsh-hello h1 { overflow-wrap: anywhere; }
/* organiser event stub: "Revenue ₹90,55,990.90" overflowed the fixed 168px side column */
.nb .ev-stub__side { width: auto; min-width: 168px; max-width: 48%; }
.nb .ev-stub__sold { flex-wrap: wrap; }
.nb .ev-stub__sold b { white-space: nowrap; }
@media (max-width: 640px) { .nb .ev-stub__side { max-width: none; } }

/* wizard bottom bar on a phone: "Save as draft" + "Save changes" ran 90px off a 360px screen */
@media (max-width: 479.98px) {
  .nb .ew-bar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .nb .ew-bar__right { min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
  .nb .ew-bar .btn { padding-left: 12px; padding-right: 12px; font-size: 14px; white-space: nowrap; min-width: 0; }
  .nb .ew-bar__right .btn { flex: 0 1 auto; }
  .nb #ew-back { flex: none; }
}

/* Participants -> Export / Bibs popovers: a sheet on phones instead of a box hanging off both edges */
@media (max-width: 640px) {
  .nb .pl-more[open] .pl-more__body { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-height: 75vh; overflow-y: auto; z-index: var(--z-sheet); }
}

/* top bar "Any date" select: wide enough for "This weekend" without cutting it (sweep: narrow fields).
   Where the browser sizes it to the chosen option (field-sizing above), nothing can be cut: no minimum,
   so the chevron sits right after "Any date" like the city's. */
.nb .topbar select[name=when] { min-width: 160px; }
@supports (field-sizing: content) { .nb .topbar select[name=when]:not(#nb-ui) { min-width: 0; } }

/* the list toolbar on narrow phones: search on its own row (it was squeezed to ~100px beside "Filters") */
@media (max-width: 419.98px) {
  .nb .toolbar { flex-wrap: wrap !important; }
  .nb .toolbar .search { flex: 1 1 100% !important; }
  .nb .toolbar .toolbar-filters-btn { margin-left: auto; }
}
/* top bar search: wide enough for its placeholder */
.nb .topbar input[type=search][name=search] { min-width: 180px; }
/* filter selects (list toolbars, orders filters): wide enough for their longest option */
.nb .toolbar select, .nb [class*=filters] select, .nb .ord-filter select { min-width: 160px !important; }
