/* Craft Planner, on top of refining.css (same dark look, same controls). Layout follows the reference planner:
   settings on top, selected recipes on the left, overview / materials / weight / fame on the right. */
.chip--wide { padding-inline: .9rem; }
.btn--sm { padding: .3rem .7rem; font-size: .85rem; }
.btn--icon { padding: .3rem .5rem; }
.badge-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .25); font-size: .75rem; font-weight: 700; }
.badge-count[hidden] { display: none; }
.icon-btn { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 .35rem; border-radius: var(--radius); border: 1px solid var(--border); background: #26282c; color: var(--text); font-size: 1rem; line-height: 1; }
.icon-btn:hover:not(:disabled) { border-color: #5a6169; background: #2e3237; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.empty--small { padding: 1rem; }

/* presets */
.presets__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; }
.presets__name { flex: 1 1 200px; max-width: 280px; }
.presets__select { flex: 1 1 200px; max-width: 280px; }
#presetNote { margin-top: .75rem; }

/* settings row */
.setup { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem 1.75rem; }
.setup__recipe { flex: 1 1 340px; min-width: 0; scroll-margin-top: 70px; }
.setup__rrr { flex: 0 0 150px; }
.setup__more { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem 1.5rem; margin-top: 1.25rem; }
.craft-cities { align-items: start; }

/* recipe combobox */
.combo { position: relative; }
.combo .control { padding-inline-end: 2.4rem; }
.combo__clear { position: absolute; inset-inline-end: .35rem; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 6px; }
.combo__clear:hover { color: var(--text); background: #2e3237; }
.combo__panel { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 60; background: #1d1e21; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 18px 40px rgba(0, 0, 0, .55); padding: .9rem; max-height: min(560px, calc(100vh - 150px)); overflow: auto; }
.combo__panel[hidden] { display: none; }
.picker__groups { margin-bottom: .8rem; }
.picker__filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin-bottom: .6rem; }
.picker__filters .field { min-width: 140px; }
.picker__count { margin-inline-start: auto; }
.picker__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .75rem; }
.picker__item { background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.picker__item[aria-selected="true"] { border-color: var(--blue); background: rgba(13, 110, 253, .12); }
.picker__label { display: flex; align-items: center; gap: .6rem; padding: .35rem .6rem; cursor: pointer; min-height: 48px; }
.picker__label input { width: 16px; height: 16px; flex: none; accent-color: var(--blue); }
.picker__label img { border-radius: 6px; flex: none; }
.picker__title { font-weight: 600; font-size: .88rem; min-width: 0; overflow-wrap: anywhere; }
.picker__state { margin-inline-start: auto; }
.picker__more { margin-top: .8rem; }
.picker__foot { position: sticky; bottom: -.9rem; display: flex; gap: .6rem; margin: .8rem -.9rem -.9rem; padding: .6rem .9rem; background: #1d1e21; border-top: 1px solid var(--border); }

/* clear confirmation */
.confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .35rem .75rem; border: 1px solid rgba(217, 83, 79, .55); border-radius: var(--radius); background: rgba(217, 83, 79, .1); }
.confirm[hidden] { display: none; }

/* two-column layout */
.planner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.planner__left, .planner__right { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.planner__right[hidden] { display: none; }
.planner .card__body, .rcard, .recipes { min-width: 0; }

/* recipe cards */
.recipes { display: flex; flex-direction: column; gap: 1rem; }
.rcard { --rc: #b4915c; background: var(--card-alt); border: 1px solid var(--border); border-inline-start: 4px solid var(--rc); border-radius: var(--radius); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .8rem; }
.rcard.is-zero { opacity: .65; }
.rcard__head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; }
.rcard__move { display: flex; gap: .3rem; }
.rcard__icon { border-radius: 8px; flex: none; }
.rcard__title { flex: 1 1 200px; min-width: 0; }
.rcard__name { font-size: 1rem; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin: 0; }
.rcard__sub { margin-top: .1rem; }
.rcard__profit { font-weight: 700; font-size: 1.02rem; white-space: nowrap; border-bottom: 1px solid currentColor; }
.rcard__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.25rem; padding-top: .7rem; border-top: 1px solid var(--border); }
.rcard__row .field { gap: .25rem; }
.rcard__row .field__label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.rcard__row .mini { width: 92px; text-align: center; }
.stepper { display: inline-flex; align-items: center; gap: .25rem; }
.stepper .mini { width: 64px; }
.rstat-row { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-inline-start: auto; }
.rstat { display: flex; flex-direction: column; gap: .15rem; }
.rstat__l { font-size: .75rem; color: var(--muted); }
.rstat__v { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.rcard__warn { color: #ffd25a; }
.rcard__details[hidden] { display: none; }
.rcard__details { display: flex; flex-direction: column; gap: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.rcard__opts { display: flex; flex-wrap: wrap; gap: .75rem 1rem; }
.rcard__opts .field { min-width: 150px; }
.rcard__opts .rcard__variant[hidden] { display: none; }
.rcard__facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem .75rem; }
.fact { display: flex; flex-direction: column; gap: .1rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, .02); }
.fact strong { font-size: .9rem; overflow-wrap: anywhere; }
.rcard__h { margin: .2rem 0 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.plist { display: flex; flex-direction: column; gap: .5rem; }
.icon-btn--tiny { width: 22px; height: 22px; min-width: 0; padding: 0; margin-inline-start: .35rem; vertical-align: middle; opacity: .7; }
.icon-btn--tiny:hover, .icon-btn--tiny.is-copied { opacity: 1; }
.icon-btn--tiny.is-copied { color: var(--green); }
.linkbtn { background: none; border: 0; padding: 0; color: #6ea8fe; cursor: pointer; text-align: left; text-decoration: underline; font: inherit; }
.linkbtn:hover { filter: brightness(1.2); }
.jprog { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .25rem; }
.prow { --rc: #b4915c; display: grid; grid-template-columns: 40px minmax(0, 1.2fr) minmax(110px, 140px) 30px minmax(0, 1fr); align-items: center; gap: .6rem .8rem; padding: .55rem .7rem; background: rgba(255, 255, 255, .03); border: 1px solid var(--border); border-inline-start: 3px solid var(--rc); border-radius: var(--radius); }
.prow.is-missing .prow__icon { opacity: .6; }
.prow__icon { border-radius: 8px; }
.prow__title { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 600; font-size: .9rem; }
.prow__price .mini { width: 100%; text-align: center; }
.prow__price .age { text-align: center; margin-top: 2px; line-height: 1.2; }
.prow__info { display: flex; flex-direction: column; gap: .1rem; font-size: .82rem; line-height: 1.3; min-width: 0; }
.prow__info bdi { unicode-bidi: isolate; }

/* city compare popover */
.citypop { position: fixed; z-index: 300; width: min(360px, calc(100vw - 16px)); background: #1d1e21; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 18px 40px rgba(0, 0, 0, .6); padding: .7rem; display: flex; flex-direction: column; gap: .5rem; }
.citypop__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .88rem; }
.citypop ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.citypop li button { width: 100%; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: .1rem .6rem; text-align: start; padding: .4rem .55rem; background: #26282c; border: 1px solid transparent; border-radius: 6px; color: var(--text); }
.citypop li button .small { grid-column: 2 / -1; }
.citypop li button:hover, .citypop li button.is-current { border-color: var(--blue); }

/* overview */
.ov-list, .mat-list, .fame-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.ov-item { display: flex; align-items: center; gap: .7rem; padding: .45rem .65rem; background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.ov-item img { border-radius: 6px; flex: none; }
.ov-item__name { flex: 1; min-width: 0; font-weight: 600; font-size: .88rem; }
.ov-item__v { white-space: nowrap; font-size: .92rem; }
.ov-item.is-missing .ov-item__v { color: var(--muted); }
.ov-totals { margin: 1rem 0 .4rem; display: flex; flex-direction: column; }
.ov-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .4rem .2rem; border-bottom: 1px solid var(--border); }
.ov-total dt { color: var(--muted); }
.ov-total dd { margin: 0; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
#totalsNote:not(:empty) { color: #ffd25a; }

/* materials */
.mat-list { max-height: 560px; overflow: auto; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .4rem .65rem; background: var(--card-alt); border: 1px solid var(--border); border-inline-start: 3px solid #b4915c; border-radius: var(--radius); }
.mrow.is-done { opacity: .6; }
.mrow__check { display: flex; align-items: center; gap: .6rem; cursor: pointer; min-width: 0; }
.mrow__check input { width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
.mrow__check img { border-radius: 6px; flex: none; }
.mrow__name { font-weight: 600; font-size: .88rem; overflow-wrap: anywhere; }
.mrow__nums { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; font-size: .88rem; }
.mat-count { margin-top: .75rem; text-align: end; font-weight: 700; }

/* weight */
.weight { display: flex; flex-direction: column; gap: 1rem; }
.weight__cap { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
.weight__cap-input { display: inline-flex; align-items: center; gap: .4rem; }
.weight__cap-input .mini { width: 96px; }
.seg--wide { display: flex; flex-wrap: wrap; width: 100%; }
.seg--wide .seg__btn { flex: 1 1 auto; padding: .35rem .5rem; font-size: .85rem; }
.wsum { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem .2rem; }
.wsum--total { border-top: 1px solid var(--border); margin-top: .4rem; padding-top: .7rem; font-weight: 700; }
.wmount { display: flex; align-items: center; gap: .8rem; padding: .7rem; background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.wmount img { border-radius: 8px; flex: none; }
.wmount__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.wmount__name { font-weight: 600; }
.wbar__track { height: 10px; border-radius: 999px; background: #2b2e33; overflow: hidden; }
.wbar__fill { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.wbar__fill.is-over { background: var(--red-btn); }

/* fame */
.fame__ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.25rem; margin-bottom: 1rem; }
.fame__bonus { display: inline-flex; align-items: center; gap: .4rem; }
.fame__bonus .mini { width: 80px; }
#fameTabs { margin-bottom: 1rem; }
.fame-item { display: flex; align-items: center; gap: .7rem; padding: .45rem .65rem; background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.fame-item img { border-radius: 6px; flex: none; }
.fame-item > div { flex: 1; min-width: 0; font-size: .88rem; }
.fame-item > strong { white-space: nowrap; }

@media (max-width: 1280px) { .rcard__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .setup__more { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1060px) {
  .planner { grid-template-columns: minmax(0, 1fr); }
  .picker__list { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .setup__more { grid-template-columns: 1fr; }
  .setup__rrr { flex: 1 1 100%; }
  .rcard__row { gap: .6rem 1rem; }
  .rstat-row { margin-inline-start: 0; width: 100%; }
  .prow { grid-template-columns: 40px minmax(0, 1fr) 30px; }
  .prow__price { grid-column: 1 / 3; }
  .prow__cities { grid-column: 3; grid-row: 2; }
  .prow__info { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: .2rem .8rem; }
  .rcard__facts { grid-template-columns: 1fr; }
  .presets__name, .presets__select { max-width: none; flex-basis: 100%; }
  .combo__panel { position: fixed; inset-inline: 8px; top: auto; bottom: 8px; max-height: 70vh; }
}

/* ==========================================================================
   Reference look. Sizes, colours and spacing follow the measurements taken from the reference planner at 1440 px
   (card #202226 / border rgba(255,255,255,.15) / radius 6, inputs 38 px, recipe cards with a 3 px tier stripe, etc.).
   These rules come last on purpose and override the older ones above.
   ========================================================================== */
#planner { --rc: #b4915c; --c-muted: #6c757d; --c-soft: rgba(255, 255, 255, .55); --c-line: rgba(255, 255, 255, .1); --c-fill: rgba(255, 255, 255, .03); }
#planner .intro h1 { display: flex; align-items: center; gap: .6rem; font-size: 2rem; font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, .55); margin: 0; }
#planner .intro__icon { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .22); object-fit: cover; }
#planner .intro__text { max-width: 600px; margin: 1rem 0 1rem; font-size: 1rem; }
#planner .alert { background: #1a1d20; border: 1px solid #343a40; border-radius: 6px; padding: 16px 48px 16px 16px; color: #dee2e6; }
#planner .alert strong { color: #fff; }
.rule { border: 0; border-top: 1px solid rgba(253, 253, 253, .25); margin: 24px 0; opacity: 1; }
.rule--tight { margin: 16px 0; }

.cpanel { background: #202226; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; margin-bottom: 16px; box-shadow: none; }
.cpanel .card__body { padding: 16px; }
.ctitle { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.ctitle--mb { margin-bottom: 12px; }
.ctitle--mb0 { margin: 0; }
.clabel { display: block; margin-bottom: 8px; font-size: 1rem; font-weight: 600; }
.cinput, .cselect { width: 100%; height: 38px; padding: 6px 12px; background: #202226; color: var(--text); border: 1px solid #495057; border-radius: 6px; font: inherit; font-size: 1rem; }
.cinput:focus, .cselect:focus, .minput:focus, .pinput:focus, .sinput:focus { outline: 0; border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .25); }
.cinput::placeholder { color: rgba(255, 255, 255, .45); }
.cselect { appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fdfdfd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 12px; }
.cmuted { color: var(--c-muted); font-size: .85rem; }

.cbtn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 6px 12px; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 1rem; font-weight: 700; color: #fff; cursor: pointer; }
.cbtn:disabled { opacity: .65; cursor: not-allowed; }
.cbtn--primary { background: #0d6efd; border-color: #0d6efd; }
.cbtn--primary:hover:not(:disabled) { background: #0b5ed7; }
.cbtn--secondary { background: #3a3d41; }
.cbtn--secondary:hover:not(:disabled) { background: #4a4e53; }
.cbtn--danger { background: #dc3545; border-color: #dc3545; }
.cbtn--danger:hover:not(:disabled) { background: #bb2d3b; }
.cbtn kbd { display: inline-grid; place-items: center; min-width: 20px; padding: 0 4px; border-radius: 6px; background: #e5e7eb; color: #111827; font: inherit; font-size: .75rem; font-weight: 700; line-height: 18px; }
.cbtn.is-current { box-shadow: 0 0 0 2px rgba(110, 168, 254, .6); }
#planner .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.presets__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.presets__row .cinput, .presets__row .cselect { width: 220px; }
#presetNote { margin: 8px 0 0; }

.setup { display: grid; grid-template-columns: 4fr 2fr 2fr 2fr 2fr; gap: 16px 24px; align-items: start; }
.setup__recipe { min-width: 0; scroll-margin-top: 70px; }
.setup__sw .switch { min-height: 38px; }
.recipe-search { display: flex; align-items: center; gap: 10px; }
.recipe-search__icon { display: grid; place-items: center; width: 30px; flex: none; color: var(--c-muted); }
.recipe-search .cinput { flex: 1; min-width: 0; }
.recipe-search__clear { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 0; border-radius: 6px; background: #3a3d41; color: #fff; cursor: pointer; }
.recipe-search__clear:hover { background: #4a4e53; }
#planner .combo__panel { top: calc(100% + 8px); }
.city-grid.craft-cities { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; }
.select-dot { position: relative; }
.select-dot .dot { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); z-index: 1; pointer-events: none; }
.select-dot .cselect { padding-inline-start: 30px; }

/* two columns: 7 : 5 */
.planner { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; }
.planner__left, .planner__right { gap: 0; }

/* item cell: image, name, pill */
.icell { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.icell__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.icell__name { font-size: .875rem; font-weight: 400; line-height: 1.4; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; flex: none; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); border-radius: 6px; }
.pill__btn { display: grid; place-items: center; width: 30px; height: 21px; padding: 0; border: 0; background: none; color: rgba(255, 255, 255, .6); cursor: pointer; }
.pill__btn:hover { color: #fff; }
.pill__btn.is-copied { color: var(--green); }
.info { display: inline-flex; color: rgba(255, 255, 255, .45); cursor: help; }
.info:hover, .info:focus { color: rgba(255, 255, 255, .8); outline: 0; }
.ctitle .info { margin-inline-start: 2px; }

/* recipe card */
.recipes { gap: 16px; }
#planner .rcard { padding: 0; gap: 0; background: transparent; border: 1px solid rgba(255, 255, 255, .1); border-inline-start: 3px solid var(--rc); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.rcard__head { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; padding: 12px 20px; background: var(--c-fill); }
.rcard__move { display: flex; gap: 5px; flex: none; }
.obtn { display: grid; place-items: center; width: 38px; height: 34px; padding: 0; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); color: #fff; cursor: pointer; }
.obtn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.obtn:disabled { background: #6c757d; border-color: #6c757d; opacity: .65; cursor: not-allowed; }
.rcard__icon { border-radius: 4px; flex: none; }
.rcard__profit { margin-inline-start: auto; flex: none; padding: 0 8px; font-size: .9rem; font-weight: 700; white-space: nowrap; border-bottom: 2px dotted currentColor; line-height: 1.4; }
.rcard__actions { display: flex; gap: 6px; flex: none; }
.rbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 38px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); color: #fff; font: inherit; font-size: .8125rem; cursor: pointer; }
.rbtn:hover { background: rgba(255, 255, 255, .12); }
.rbtn[aria-expanded="true"] .rbtn__chev { transform: rotate(180deg); }
.rbtn--danger { color: #dc3545; background: rgba(220, 53, 69, .1); border-color: rgba(220, 53, 69, .3); font-weight: 500; }
.rbtn--danger:hover { background: rgba(220, 53, 69, .2); }
#planner .rcard__row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 0; padding: 6px 12px 10px; background: var(--c-fill); border-top: 1px solid rgba(255, 255, 255, .05); }
.rfield { padding: 0 4px; width: 112px; }
.rfield--qty { width: 150px; }
.rfield__l, .rstat__l { display: flex; align-items: center; gap: 4px; margin: 8px 0 4px; font-size: .875rem; color: var(--c-muted); line-height: 1.2; white-space: nowrap; }
.stepper { display: inline-flex; align-items: stretch; width: 118px; }
.sbtn { width: 31px; height: 32px; padding: 0; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); color: #fff; font-weight: 700; cursor: pointer; }
.sbtn:first-child { border-radius: 6px 0 0 6px; border-right: 0; }
.sbtn:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.sinput { width: 56px; height: 32px; padding: 0 4px; text-align: center; background: #202226; color: var(--text); border: 1px solid rgba(255, 255, 255, .1); border-radius: 0; font: inherit; font-size: .875rem; }
.minput { width: 80px; height: 32px; padding: 4px 8px; text-align: center; background: #202226; color: var(--text); border: 1px solid rgba(255, 255, 255, .2); border-radius: 6px; font: inherit; font-size: .875rem; }
.minput--w { width: 70px; height: 30px; }
.rstat-row { display: contents; }
.rstat { width: 117px; padding: 0 4px; display: block; }
.rstat__v { display: block; font-size: .875rem; color: var(--text); font-weight: 400; line-height: 1.4; }
.rstat__v small { display: block; font-size: .75rem; color: var(--c-muted); }
#planner .rcard__details { padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .06); gap: 8px; }
#planner .rcard__h { margin: 4px 0 0; font-size: .875rem; font-weight: 400; color: var(--c-muted); }
#planner .plist { gap: 12px; }

/* price rows */
#planner .prow { display: grid; grid-template-columns: minmax(0, 1fr) 120px 30px minmax(0, 175px); align-items: center; gap: 8px 16px; padding: 16px; background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .08); border-inline-start: 3px solid var(--rc); border-radius: 8px; }
#planner .prow { position: relative; padding-inline-start: 76px; }
#planner .prow__icon { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); border-radius: 4px; }
.prow__name { min-width: 0; }
.prow__title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.prow__sub { margin-top: 2px; font-size: .75rem; color: var(--c-muted); }
.pinput { width: 120px; height: 31px; padding: 4px 8px; text-align: center; background: #202226; color: var(--text); border: 1px solid rgba(255, 255, 255, .2); border-radius: 6px; font: inherit; font-size: .875rem; }
#planner .prow__price .age { margin-top: 2px; text-align: center; font-size: .75rem; color: var(--c-muted); }
.sqbtn { display: grid; place-items: center; width: 30px; height: 29px; padding: 0; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); border-radius: 6px; color: rgba(255, 255, 255, .6); cursor: pointer; }
.sqbtn:hover { color: #fff; background: rgba(255, 255, 255, .12); }
#planner .prow__info { gap: 2px; font-size: .875rem; }
#planner .prow__info strong { font-weight: 600; }
.pcity { font-size: .75rem; color: var(--c-muted); }

/* right column */
#planner .ov-list, #planner .mat-list, #planner .fame-list { gap: 8px; }
#planner .ov-item, #planner .mrow, #planner .fame-item { background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .08); border-inline-start: 3px solid var(--rc); border-radius: 8px; }
#planner .ov-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.ov-item img, .mrow img, .fame-item img { border-radius: 4px; flex: none; }
.ov-item__name { flex: 1; min-width: 0; }
.ov-item__top { display: flex; align-items: center; gap: 8px; }
.ov-item__sub, .fame-item__sub { font-size: .75rem; color: var(--c-muted); }
.ov-item__v { flex: none; font-size: .95rem; font-weight: 700; white-space: nowrap; border-bottom: 2px dotted currentColor; line-height: 1.4; }
#planner .ov-item.is-missing .ov-item__v { color: var(--c-muted); border-bottom-color: transparent; }
#planner .ov-totals { margin: 16px 0 0; }
#planner .ov-total { padding: 6px 0; border-bottom: 0; align-items: center; }
#planner .ov-total dt { display: flex; align-items: center; gap: 6px; font-size: 1rem; color: var(--c-soft); }
#planner .ov-total dd { font-size: 1.125rem; font-weight: 700; }
#planner .ov-total dd.underlined { border-bottom: 1px solid currentColor; }
#planner .mat-list { max-height: none; overflow: visible; }
#planner .mrow { display: flex; align-items: center; gap: 8px; padding: 8px; border-inline-start-width: 5px; justify-content: flex-start; }
.mrow__check { display: flex; align-items: center; gap: 8px; flex: none; }
.mrow__check input { width: 20px; height: 20px; }
.mrow__main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.mrow__name { font-weight: 400; }
#planner .mrow__nums { align-items: flex-end; margin-inline-start: auto; line-height: 1.3; }
.mrow__units { font-size: .8125rem; }
.mrow__units strong { font-size: .875rem; font-weight: 700; }
.mrow__units .muted, .mrow__kg { color: var(--c-muted); font-size: .75rem; }
#planner .mat-count { margin-top: 12px; display: flex; justify-content: space-between; font-size: .95rem; color: var(--c-soft); font-weight: 400; }
#planner .mat-count::after { content: none; }

.weight__cap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.weight__q { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.qgroup { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid #495057; border-radius: 8px; }
.qgroup .seg__btn { padding: 6px 12px; border: 0; border-radius: 5px; background: transparent; color: rgba(255, 255, 255, .6); font: inherit; font-size: .875rem; cursor: pointer; }
.qgroup .seg__btn:hover { color: #fff; }
.qgroup .seg__btn.is-active { background: #0d6efd; color: #fff; }
.weight__mount .cselect { height: 32px; padding-block: 2px; font-size: .875rem; }
.wtabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.wtabs .wtab, .wtabs .seg__btn { padding: 10px 8px; background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; color: rgba(255, 255, 255, .75); font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer; }
.wtabs .is-active { color: #fff; background: rgba(255, 255, 255, .03); border-color: rgba(255, 255, 255, .1); }
#planner .wmount { align-items: flex-start; gap: 16px; padding: 12px 0 0; background: transparent; border: 0; }
.wmount__img { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 80px; flex: none; }
.wmount__img img { border-radius: 4px; }
.wmount__cap { font-size: .75rem; color: var(--c-muted); line-height: 1.2; text-align: center; }
#planner .wmount__body { align-items: stretch; gap: 6px; }
#planner .wmount__name { text-align: center; font-size: .875rem; font-weight: 700; }
#planner .wbar__track { height: 14px; background: #2b2e33; }
#planner .wbar__fill { background: #198754; }
.wmount__note { text-align: center; font-size: .75rem; color: var(--c-muted); }
.wmount__note.neg { color: var(--red); }
.wtotal { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--c-soft); }
.wtotal strong { font-size: 1.25rem; color: var(--text); }
.fame__ctrl { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
#planner .fame-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.fame-item__body { flex: 1; min-width: 0; }
.fame-item__top { display: flex; align-items: center; gap: 8px; }
.fame-item__v { flex: none; font-size: .8125rem; color: var(--c-muted); }
.fame-item__v strong { color: var(--text); font-size: .95rem; }
#fameTabs { margin-bottom: 12px; }

@media (max-width: 1200px) {
  .setup { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .setup__recipe { grid-column: 1 / -1; }
  .city-grid.craft-cities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1060px) {
  .planner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .setup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .city-grid.craft-cities { grid-template-columns: minmax(0, 1fr); }
  .rcard__head { flex-wrap: wrap; padding: 12px; }
  .icell { flex-basis: 60%; }
  .rcard__profit { margin-inline-start: 0; }
  #planner .prow { grid-template-columns: minmax(0, 1fr) 30px; padding-inline-start: 76px; }
  #planner .prow__price { grid-column: 1; }
  #planner .prow__info { grid-column: 1 / -1; }
  .presets__row .cinput, .presets__row .cselect { width: 100%; }
  #planner .prow .icell__name, #planner .rcard__head .icell__name { white-space: normal; }
  .rstat { width: 33%; }
  .rfield { width: 50%; }
  .rfield--qty { width: 100%; }
}

/* ---------- recipe picker (dropdown over the page) ---------- */
.cpanel--search { position: relative; z-index: 40; }
.cpanel--search .combo { position: static; }
#planner .combo__panel { position: absolute; inset-inline: 16px; top: 92px; bottom: auto; z-index: 60; display: flex; flex-direction: column; max-height: min(620px, calc(100vh - 140px)); padding: 0; overflow: hidden; background: #1b1d20; border: 1px solid #3a3f45; border-radius: 10px; box-shadow: 0 24px 60px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 0, 0, .4); }
#planner .combo__panel[hidden] { display: none; }
.picker__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 12px 16px; background: #202226; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: .9rem; }
#planner .picker__list { flex: 1 1 auto; min-height: 120px; overflow: auto; padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; align-content: start; }
#planner .picker__item { background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .08); border-radius: 8px; transition: border-color .12s, background .12s; }
#planner .picker__item:hover { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); }
#planner .picker__item[aria-selected="true"] { border-color: #0d6efd; background: rgba(13, 110, 253, .14); }
#planner .picker__label { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; cursor: pointer; }
#planner .picker__label input { width: 18px; height: 18px; flex: none; accent-color: #0d6efd; }
#planner .picker__label img { width: 40px; height: 40px; border-radius: 4px; flex: none; }
#planner .picker__title { flex: 1; min-width: 0; font-size: .875rem; font-weight: 500; line-height: 1.3; overflow-wrap: break-word; }
#planner .picker__state { margin-inline-start: 0; flex: none; font-size: .72rem; }
#planner .picker__more { align-self: center; margin: 0 0 12px; }
#planner .picker__foot { position: static; display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; background: #202226; border-top: 1px solid rgba(255, 255, 255, .08); }
#planner .picker__foot .btn--primary { background: #0d6efd; border-color: #0d6efd; font-weight: 700; }
#planner .picker__foot .btn { height: 36px; }
@media (max-width: 767px) {
  .setup__recipe { scroll-margin-top: 235px; }
  #planner .combo__panel { inset-inline: 8px; top: 96px; max-height: calc(100vh - 260px); }
  #planner .picker__list { grid-template-columns: minmax(0, 1fr); padding: 10px; }
}
.weight__q[hidden], .weight__mount[hidden] { display: none; }
#planner .wbar__fill.is-over { background: #dc3545; }

/* city dropdown with the coloured round dot (button + list instead of the native select list) */
.cdrop { position: relative; }
.cdrop > .dot { display: none; }
.cdrop__native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.select-dot .cdrop__btn, .cdrop__btn { padding-inline-start: 12px; }
.cdrop__btn { display: flex; align-items: center; gap: 8px; text-align: start; cursor: pointer; padding-inline-start: 12px; }
.cdrop__btn .cdrop__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdrop__dot { width: 10px; height: 10px; flex: none; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28); box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.cdrop__menu { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 70; margin: 0; padding: 4px; list-style: none; background: #1b1d20; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; box-shadow: 0 14px 34px rgba(0, 0, 0, .6); max-height: 320px; overflow: auto; }
.cdrop__menu[hidden] { display: none; }
.cdrop__opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: 1rem; outline: 0; }
.cdrop__opt:hover, .cdrop__opt:focus { background: rgba(255, 255, 255, .08); }
.cdrop__opt.is-on { background: rgba(13, 110, 253, .22); }
.cdrop__opt.is-on:focus { background: rgba(13, 110, 253, .35); }
.cpanel--price { position: relative; z-index: 30; }
.mat-empty { margin: 0; font-size: .875rem; color: var(--c-muted); }
.mat-empty[hidden], #materialsCount[hidden] { display: none; }

/* ---------- Crafting Presets (card, preset boxes, dialog) ---------- */
.count-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 6px; background: #3a3d41; color: #fff; font-size: .75rem; font-weight: 700; }
.count-badge[hidden] { display: none; }
.presets__empty { margin: 28px 0 24px; text-align: center; font-size: 1rem; color: var(--c-muted); }
.presets__empty[hidden] { display: none; }
.presets__list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.presets__list:empty { display: none; }
.pcard { display: flex; align-items: stretch; justify-content: space-between; gap: 16px; width: min(580px, 100%); padding: 16px 20px; background: rgba(255, 255, 255, .02); border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; }
.pcard__main { min-width: 0; flex: 1; }
.pcard__name { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.pcard__desc { margin-top: 2px; font-size: .875rem; color: rgba(255, 255, 255, .75); overflow-wrap: anywhere; }
.pcard__meta { margin-top: 8px; font-size: .95rem; line-height: 1.55; color: var(--c-muted); }
.pcard__meta i { font-style: normal; margin: 0 4px; }
.pcard__meta .pos { color: var(--green); font-weight: 400; }
.pcard__meta .neg { color: var(--red); font-weight: 400; }
.pcard__btns { display: flex; flex-direction: column; flex: none; width: 66px; align-self: flex-start; border: 1px solid rgba(255, 255, 255, .25); border-radius: 4px; overflow: hidden; }
.pcard__btn { display: grid; place-items: center; height: 36px; padding: 0; background: transparent; border: 0; color: rgba(255, 255, 255, .7); font: inherit; font-size: .875rem; cursor: pointer; }
.pcard__btn + .pcard__btn { border-top: 1px solid rgba(255, 255, 255, .25); }
.pcard__btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.pcard__btn--load { color: #fff; font-weight: 700; border: 1px solid #fff; margin: -1px -1px 0; height: 38px; }
.pcard__btn--del { color: #dc3545; border-top-color: #dc3545 !important; }
.pcard__btn--del:hover { background: rgba(220, 53, 69, .15); color: #ff6b78; }
.cbtn--warning { background: #ffc107; border-color: #ffc107; color: #000; }
.cbtn--warning:hover { background: #ffca2c; }
.cbtn--warning[hidden] { display: none; }
.cbtn--success { background: #198754; border-color: #198754; }
.cbtn--success:hover { background: #157347; }
#presetNote:empty { display: none; }
#presetNote { margin: 12px 0 0; }

.pmodal { position: fixed; inset: 0; z-index: 400; display: grid; place-items: start center; padding: 6vh 12px 12px; background: rgba(0, 0, 0, .6); overflow: auto; }
.pmodal[hidden] { display: none; }
.pmodal__dialog { width: min(500px, 100%); background: #202226; border: 1px solid rgba(255, 255, 255, .18); border-radius: 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.pmodal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.pmodal__head h3 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.pmodal__x { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; background: none; border: 0; color: rgba(255, 255, 255, .6); cursor: pointer; border-radius: 6px; }
.pmodal__x:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.pmodal__body { padding: 20px; }
.clabel--plain { font-weight: 400; margin-bottom: 8px; }
.pmodal__lbl2 { margin-top: 16px; }
.ctextarea { height: auto; min-height: 76px; resize: vertical; font-family: inherit; line-height: 1.4; }
.pmodal__err { margin: 6px 0 0; font-size: .85rem; color: #ff6b78; }
.pmodal__err[hidden] { display: none; }
#presetDeleteText { margin: 0; font-size: 1rem; line-height: 1.5; }
.pmodal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, .12); }
@media (max-width: 575px) { .pcard { flex-direction: column; } .pcard__btns { flex-direction: row; width: 100%; } .pcard__btn { flex: 1; } .pcard__btn + .pcard__btn { border-top: 0; border-left: 1px solid rgba(255, 255, 255, .25); } .pcard__btn--load { margin: -1px 0 -1px -1px; } }
.presets__sync { margin: 10px 0 0; }
.presets__sync a { color: #6ea8fe; }
