/* FJN System — E0 component styles: E1 screens (dictionaries, partner discounts, calendar).
   Loaded after fjn-screens-access.css (see templates/base.html); order matters. */
/* ---------- E1-54 Quote dictionaries ---------- */
.fjn-dictionary > .fjn-table-wrap, .fjn-dictionary > p { max-width: 960px; }
.fjn-dictionary__table td { vertical-align: middle; }
.fjn-dictionary__swatch { width: 44px; padding-right: 0; }
.fjn-dictionary__swatch svg { display: block; }
.fjn-dictionary__off td { background: var(--fjn-table-group); }
.fjn-dictionary__off b { color: var(--fjn-text-2); }
.fjn-dictionary__kind { color: var(--fjn-text-2); font-size: 14px; }
.fjn-dictionary__desc { display: block; }
.fjn-lock-chip--sm { height: 24px; padding: 0 8px; }
.fjn-dictionary__terms { max-width: 600px; }
.fjn-dictionary__number { display: flex; align-items: center; gap: 10px; }
.fjn-dictionary__number .fjn-input { width: 120px; flex: none; text-align: right; font-family: var(--fjn-font-mono); }

/* ---------- E1-55 Partner discounts ---------- */
/* D102: history panel under the group table */
.fjn-discounts { display: flex; flex-direction: column; gap: var(--fjn-sp-3); }
.fjn-discounts > .fjn-card--flush { width: 100%; max-width: 720px; }
.fjn-discounts__history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--fjn-surface-2); }
.fjn-discounts__history-head .fjn-card__title { margin: 0; font-size: 16px; }
.fjn-discounts__event {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 4px 16px; align-items: start;
  padding: 10px 16px; border-bottom: 1px solid var(--fjn-surface-2); font-size: 14px; line-height: 20px;
}
.fjn-discounts__event:last-child { border-bottom: 0; }
.fjn-discounts__when { display: flex; flex-direction: column; gap: 2px; }
.fjn-discounts__state { font-size: 12px; font-weight: var(--fjn-fw-bold); color: var(--fjn-text-2); }
.fjn-discounts__state--planned { color: #0B6477; }
.fjn-discounts__state--in_force { color: var(--fjn-success-700); }
.fjn-discounts__empty { margin: 0; padding: 12px 16px; }
@media (max-width: 767px) { .fjn-discounts__event { grid-template-columns: minmax(0, 1fr); } }
.fjn-table .fjn-dictionary__price, .fjn-table .fjn-dictionary__actions { text-align: right; }
.fjn-dictionary__actions .fjn-row-actions { justify-content: flex-end; }

/* ---------- D97 Partner (B2B) ---------- */
.fjn-partner-switch { display: flex; flex-direction: column; gap: var(--fjn-sp-4); }
.fjn-partner-switch:has(.fjn-toggle__input:checked) { border-color: var(--fjn-brand-600); }
.fjn-partner-switch__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--fjn-sp-4); }
.fjn-partner-switch__text { display: flex; flex-direction: column; gap: 6px; }
.fjn-partner-switch__text .fjn-card__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fjn-partner-switch__toggle { flex: none; }
.fjn-partner-switch__toggle:has(.fjn-toggle__input:checked) .fjn-toggle__state--on { display: inline; }
.fjn-partner-switch__toggle:has(.fjn-toggle__input:checked) .fjn-toggle__state--off { display: none; }
.fjn-partner-switch__info { display: none; }
.fjn-partner-switch:has(.fjn-toggle__input:checked) .fjn-partner-switch__info { display: flex; }
.fjn-lock-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--fjn-r-sm);
  background: var(--fjn-neutral-100); color: var(--fjn-text-2); font-size: 12px; font-weight: var(--fjn-fw-bold);
}
.fjn-tag--partner { display: inline-flex; align-items: center; gap: 4px; background: #E3ECF7; color: #173F6F; }
.fjn-card-page__tags { margin-top: 6px; }
.fjn-partner-unset { color: var(--fjn-warning-700); font-weight: var(--fjn-fw-bold); }
.fjn-partner-set { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.fjn-partner-set a { display: flex; align-items: center; min-height: 32px; font-size: 14px; font-weight: var(--fjn-fw-bold); }
@media (max-width: 1279px) {
  .fjn-partner-switch__toggle .fjn-toggle__track { width: 56px; height: 32px; }
  .fjn-partner-switch__toggle .fjn-toggle__track::after { width: 26px; height: 26px; }
  .fjn-partner-switch__toggle .fjn-toggle__input:checked + .fjn-toggle__track::after { left: 27px; }
}

/* ---------- D98 Discounts from a date (E1-55) ---------- */
.fjn-discounts-form { display: flex; flex-direction: column; gap: var(--fjn-sp-4); }
.fjn-discounts__rate { width: 1%; text-align: right; white-space: nowrap; }
.fjn-table .fjn-discounts__rate { text-align: right; }
.fjn-discounts__group { font-weight: var(--fjn-fw-regular); }
.fjn-discounts__input { position: relative; display: inline-block; }
.fjn-discounts__input .fjn-input { width: 88px; padding-right: 30px; text-align: right; font-family: var(--fjn-font-mono); font-weight: var(--fjn-fw-bold); }
.fjn-discounts__input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--fjn-text-2); pointer-events: none; }
.fjn-discounts__row--changed { background: #FFF8EB; }
.fjn-discounts__row--changed .fjn-discounts__group { font-weight: var(--fjn-fw-bold); }
.fjn-discounts__row--changed .fjn-input { border: 2px solid var(--fjn-warning-700); }
.fjn-discounts__bar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--fjn-sp-4); flex-wrap: wrap; }
.fjn-discounts__date { margin: 0; }
.fjn-discounts__date-row { display: flex; align-items: center; gap: var(--fjn-sp-3); }
.fjn-discounts__date-row .fjn-input-group { width: 200px; flex: none; }
.fjn-calendar-anchor { position: relative; }
@media (max-width: 767px) {
  .fjn-discounts__bar { flex-direction: column; align-items: stretch; }
  .fjn-discounts__date-row { flex-direction: column; align-items: stretch; }
  .fjn-discounts__date-row .fjn-input-group { width: 100%; }
  .fjn-discounts__bar .fjn-btn { width: 100%; height: 56px; }
}

/* Popover calendar (D98): K 340 px, full screen width on the phone; cells 36 / 44 px */
.fjn-calendar {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 60; width: 340px; padding: var(--fjn-sp-3);
  background: var(--fjn-surface); border: 1px solid var(--fjn-border); border-radius: var(--fjn-r-lg); box-shadow: var(--fjn-shadow-3);
}
.fjn-calendar[hidden] { display: none; }
.fjn-calendar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--fjn-sp-2); }
.fjn-calendar__title { font-weight: var(--fjn-fw-bold); white-space: nowrap; }
.fjn-calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.fjn-calendar__dow { font-size: 12px; font-weight: var(--fjn-fw-bold); color: var(--fjn-text-2); padding: 4px 0; }
.fjn-calendar__day {
  height: 36px; border: 1px solid transparent; border-radius: var(--fjn-r-md); background: none;
  font-family: var(--fjn-font-mono); font-size: 14px; color: var(--fjn-text); cursor: pointer;
}
.fjn-calendar__day:hover:not(:disabled) { border-color: var(--fjn-border); }
.fjn-calendar__day:disabled { color: #B7BDC5; cursor: default; }
.fjn-calendar__day--today { border: 1.5px solid var(--fjn-text); }
.fjn-calendar__day--selected { background: var(--fjn-brand-600); color: var(--fjn-text-inverse); font-weight: var(--fjn-fw-bold); }
.fjn-calendar__legend { display: flex; flex-wrap: wrap; gap: 4px var(--fjn-sp-3); margin-top: var(--fjn-sp-2); font-size: 12px; color: var(--fjn-text-2); }
.fjn-calendar__legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }
.fjn-calendar__legend .is-selected { background: var(--fjn-brand-600); }
.fjn-calendar__legend .is-today { border: 1.5px solid var(--fjn-text); }
@media (max-width: 767px) {
  .fjn-calendar { position: fixed; left: var(--fjn-sp-4); right: var(--fjn-sp-4); bottom: auto; top: var(--fjn-topbar-h-m); width: auto; }
  .fjn-calendar__day { height: 44px; }
}

/* ---------- D100/D101 Dictionaries in Administration ---------- */
.fjn-dictionary { display: flex; flex-direction: column; gap: var(--fjn-sp-4); }
.fjn-dictionary__toolbar { justify-content: space-between; }
.fjn-dictionary__option { display: flex; align-items: center; min-height: 36px; padding: 0 var(--fjn-sp-2); border-radius: var(--fjn-r-sm); color: var(--fjn-text); font-weight: var(--fjn-fw-regular); text-decoration: none; }
.fjn-dictionary__option:hover { background: var(--fjn-brand-50); text-decoration: none; }
.fjn-dictionary__option[aria-current="page"] { background: var(--fjn-brand-50); font-weight: var(--fjn-fw-bold); }
.fjn-dictionary__options { list-style: none; margin: 0; padding: 0; }
.fjn-dialog--520 { width: 520px; }
.fjn-swatch-picker { display: flex; align-items: center; gap: var(--fjn-sp-3); }
.fjn-swatch-picker .fjn-input { flex: 1; }
.fjn-swatch-picker__preview { flex: none; }
.fjn-swatch-picker__presets { display: flex; flex-wrap: wrap; gap: 8px; }
.fjn-swatch-picker__preset { padding: 0; border: 3px solid transparent; border-radius: 9px; background: none; cursor: pointer; line-height: 0; }
.fjn-swatch-picker__preset[aria-pressed="true"] { border-color: var(--fjn-brand-600); }
.fjn-swatch-picker__preset:focus-visible { box-shadow: var(--fjn-focus-btn); }
.fjn-readonly-price {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--fjn-sp-2); min-height: var(--fjn-ctl); padding: 6px 12px;
  border: 1px solid var(--fjn-border); border-radius: var(--fjn-r-md); background: var(--fjn-bg); color: var(--fjn-text-2);
}
.fjn-readonly-price b { color: var(--fjn-text); font-size: 17px; white-space: nowrap; }
@media (max-width: 767px) { .fjn-dialog--520 { width: 100%; } }
.fjn-dictionary__state-m { margin-top: 4px; }
.fjn-dictionary__service { white-space: nowrap; }
@media (max-width: 767px) { .fjn-dictionary__service { white-space: normal; } .fjn-dictionary__kind.fjn-only-m { display: block; margin-top: 2px; } }
/* ---------- E0-40 service dialog (D102): K/T dialog, M full screen ---------- */
.fjn-dialog--560 { width: 560px; }
.fjn-service-grid { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px 16px; }
.fjn-service-grid .fjn-field { margin: 0; }
.fjn-service-grid__wide { grid-column: 1 / -1; }
.fjn-service-grid__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fjn-service-grid__code .fjn-input { width: 100%; }
@media (max-width: 767px) {
  .fjn-dialog--560 { width: 100%; }
  .fjn-service-grid, .fjn-service-grid__pair { grid-template-columns: minmax(0, 1fr); }
  .fjn-app-page .fjn-dialog--full-m:modal { margin: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .fjn-app-page .fjn-dialog--full-m::backdrop { bottom: 0; }
  .fjn-dialog--full-m > form { display: flex; flex-direction: column; min-height: 100%; }
  .fjn-dialog--full-m .fjn-dialog__body { flex: 1; }
}
/* Search list inside a dialog: in the flow, so the dialog grows instead of clipping it */
.fjn-dialog .fjn-search-select { flex-wrap: wrap; }
.fjn-dialog .fjn-search-select__list { position: static; flex-basis: 100%; margin-top: 4px; }
.fjn-search-select__list .fjn-chips__option[aria-current="true"] { background: var(--fjn-brand-50); font-weight: var(--fjn-fw-bold); }
