/* Bekito 展示会ノート — styles of the app screens. Kit tokens only (var(--bk-…)).
   The page is the only thing that scrolls (and a dialog, when one is open): no scrolling boxes inside,
   and below 1100 x 760 nothing is pinned. */

.tj-skel-title { height: 36px; width: 55%; }
.tj-skel-block { height: 180px; }
.tj-skel-line { height: 18px; width: 80%; }
.tj-hide { display: none !important; }
.tj-spacer { flex: 1 1 auto; }

/* the product name in the top bar is a link home; it reads as a name, not as a link */
a.bk-brand__product { color: var(--bk-fg); text-decoration: none; }
a.bk-brand__product:hover { color: var(--bk-fg); }

/* text areas grow with their text instead of showing a scrollbar (the kit's autoGrow() covers browsers without field-sizing) */
textarea[data-bk-autogrow] { field-sizing: content; resize: none; overflow: hidden; }

/* a busy button hides its label at once, so the spinner never draws over the words */
.bk-btn[aria-busy="true"] > * { visibility: hidden; }

/* words that differ between mouse and touch screens (「ここに置く」 only where you can drop a file) */
.tj-for-touch { display: none; }
@media (pointer: coarse) { .tj-for-mouse { display: none; } .tj-for-touch { display: inline; } }

/* ---------- inline editing (company name, next step, show name) ---------- */
.tj-inline { display: inline-flex; align-items: flex-start; gap: 8px; max-width: 100%; min-width: 0; margin: -6px -10px; padding: 6px 10px; min-height: 44px; border: 0; border-radius: var(--bk-r-sm); background: none; color: inherit; font: inherit; text-align: left; line-height: inherit; transition: background var(--bk-fast); }
.tj-inline:hover { background: var(--bk-bg-sunken); }
.tj-inline > span { min-width: 0; align-self: center; }
.tj-inline > .bk-ico { color: var(--bk-fg-3); flex-shrink: 0; height: 1.6em; align-items: center; }
.tj-inline > .bk-ico > svg { width: 16px; height: 16px; }
/* long names made of several words run together (会社名, 製品名): break where the script changes, not inside a word */
.tj-keep { word-break: keep-all; overflow-wrap: anywhere; }
.tj-inline-form { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tj-inline-form__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.tj-inline-form__row .bk-input { flex: 1 1 12em; min-width: 0; }
.tj-inline-form .bk-textarea { min-height: 0; }

/* ---------- cards cut out of their photo (see js/cards.js) ---------- */
.tj-crop { position: relative; display: block; overflow: hidden; padding: 0; border: 1px solid var(--bk-line); border-radius: var(--bk-r-sm); background: var(--bk-bg-sunken); color: inherit; aspect-ratio: 91 / 55; width: 100%; }
.tj-crop > img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; }
.tj-crop.is-whole > img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
button.tj-crop { cursor: zoom-in; transition: border-color var(--bk-fast), transform var(--bk-fast) var(--bk-ease); }
button.tj-crop:hover { border-color: var(--bk-fg-3); }
button.tj-crop:active { transform: scale(.98); }
.tj-crop__zoom { position: absolute; right: 3px; bottom: 3px; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--bk-surface) 92%, transparent); box-shadow: var(--bk-shadow-1); }
.tj-crop__zoom::before { content: ""; position: absolute; left: 5px; top: 5px; width: 8px; height: 8px; border: 1.8px solid var(--bk-fg-2); border-radius: 50%; }
.tj-crop__zoom::after { content: ""; position: absolute; left: 13px; top: 13px; width: 5px; height: 1.8px; background: var(--bk-fg-2); transform: rotate(45deg); transform-origin: left center; }
.tj-crop--large { border-radius: var(--bk-r-md); box-shadow: var(--bk-shadow-1); }
/* an upright card would be very tall at the column's width: give it a height instead and centre it */
.tj-crop.is-portrait { width: auto; height: 150px; max-width: 100%; margin-inline: auto; }
.tj-crop--large.is-portrait { height: min(56dvh, 440px); }
.tj-crop--large.is-whole { aspect-ratio: 4 / 3; }
.tj-crop--large.is-whole > img { object-fit: contain; }

/* ---------- upload ---------- */
.tj-upload { display: flex; flex-direction: column; gap: 20px; }
.tj-upload.has-startbar { padding-bottom: 72px; } /* room for the start bar that stays at the bottom of a phone */
@media (min-width: 640px) { .tj-upload.has-startbar { padding-bottom: 0; } }
.tj-title { font-size: var(--bk-text-2xl); line-height: 1.35; min-width: 0; }
.tj-tip { display: flex; gap: 8px; align-items: flex-start; font-size: var(--bk-text-sm); line-height: 1.6; color: var(--bk-fg-2); margin-top: -8px; }
.tj-tip .bk-ico { color: var(--bk-info); height: 1.6em; align-items: center; }
.tj-tip .bk-ico > svg { width: 16px; height: 16px; }
.tj-shoot { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--bk-r-md); background: var(--bk-bg-sunken); }
.tj-shoot__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tj-shoot__btns .bk-btn { flex: 1 1 10em; }
.tj-picked { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.tj-tile { position: relative; aspect-ratio: 1; border-radius: var(--bk-r-md); overflow: hidden; background: var(--bk-bg-sunken); border: 1px solid var(--bk-line); display: grid; place-items: center; color: var(--bk-fg-3); }
.tj-tile img { width: 100%; height: 100%; object-fit: cover; }
.tj-tile__state { position: absolute; inset: auto 0 0 0; padding: 4px 6px; font-size: var(--bk-text-xs); line-height: 1.35; font-weight: 700; text-align: center; background: color-mix(in srgb, var(--bk-surface) 92%, transparent); color: var(--bk-fg-2); }
.tj-tile.is-bad { border-color: var(--bk-danger); }
.tj-tile.is-bad .tj-tile__state { color: var(--bk-danger); }
.tj-tile__x { position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: start end; padding: 4px; color: var(--bk-fg); }
.tj-tile__x span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--bk-surface) 94%, transparent); box-shadow: var(--bk-shadow-1); }
.tj-tile__x svg { width: 15px; height: 15px; }
.tj-datanote ul { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.tj-datanote li { padding-left: 14px; position: relative; }
.tj-datanote li::before { content: ""; position: absolute; left: 2px; top: .75em; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .5; }
.tj-startbar { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
@media (min-width: 640px) { .tj-startbar { flex-direction: row; align-items: center; } .tj-startbar .bk-btn--primary { min-width: 260px; } }
/* once photos are chosen, the start button stays in view at the bottom of a phone screen */
@media (max-width: 639px) {
  .tj-startbar.is-sticky { position: fixed; inset: auto 0 0 0; z-index: var(--bk-z-bar); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bk-bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--bk-line); }
  .tj-startbar.is-sticky .bk-btn--lg { min-height: 50px; }
}
@media (hover: hover) and (pointer: fine) { .tj-camera, .tj-shoot { display: none; } }

/* ---------- board: the top stays compact so the data starts high on a short window ---------- */
.tj-board { padding-top: 4px; }
.tj-top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.tj-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; }
.tj-head__title { flex: 1 1 18em; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.tj-head .tj-title { font-size: var(--bk-text-xl); line-height: 1.4; }
.tj-head .tj-title .tj-inline { display: flex; max-width: 100%; }
.tj-counts { font-size: var(--bk-text-sm); line-height: 1.6; color: var(--bk-fg-2); }
.tj-counts__todo { margin-left: .6em; font-weight: 700; color: var(--bk-info); white-space: nowrap; }
.tj-counts__todo::before { content: "・"; margin-right: .2em; color: var(--bk-fg-3); font-weight: 400; }
html[lang="en"] .tj-counts__todo::before { content: "·"; margin-right: .5em; }
.tj-counts__todo.is-clear { color: var(--bk-ok); }
.tj-actions { display: flex; flex-wrap: nowrap; gap: 8px; }
@media (max-width: 899px) {
  .tj-actions .bk-btn:not(.tj-act--keep) { width: 44px; padding: 0; }
  .tj-actions .bk-btn:not(.tj-act--keep) .tj-act-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 420px) { .tj-actions .tj-act--keep { padding-inline: 14px; } }
.tj-notice { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-height: 40px; padding: 4px 4px 4px 12px; border-radius: var(--bk-r-md); background: var(--bk-info-soft); font-size: var(--bk-text-sm); line-height: 1.5; }
.tj-notice__text { flex: 1 1 14em; min-width: 0; }
.tj-notice .bk-link-btn { min-height: 36px; white-space: nowrap; }
.tj-notice > .bk-btn--icon { margin-left: auto; }
.tj-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tj-bar__group { display: flex; gap: 6px; flex-shrink: 0; }
.tj-bar .bk-chip { min-height: 44px; }
.tj-bar .tj-pick { flex: 1 1 180px; min-width: 0; max-width: 300px; }
.tj-bar .bk-select { min-height: 44px; text-overflow: ellipsis; }
.tj-bar .bk-search { flex: 2 1 200px; min-width: 0; }
.tj-bar .bk-search .bk-input { min-height: 44px; }
/* Chrome keeps room for the clear button even while the field is empty, which cut the hint short on phones */
.tj-bar .bk-search .bk-input:placeholder-shown::-webkit-search-cancel-button { display: none; }
.tj-toggle .bk-ico > svg { width: 15px; height: 15px; }
.tj-toggle[aria-expanded="true"] { background: var(--bk-fg); color: var(--bk-bg); border-color: var(--bk-fg); }
@media (max-width: 639px) {
  .tj-bar .tj-pick { flex: 1 1 100%; max-width: none; order: 3; }
  .tj-bar .bk-search { flex: 1 1 100%; order: 4; }
  /* the company list as wide as 「すべての会社」 needs, the search field takes the rest */
  /* English words are longer: on a phone 写真 and メモ show only their icon (and the number), so the four buttons fit one row */
  html[lang="en"] .tj-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html[lang="en"] .tj-toggle { min-width: 48px; justify-content: center; }
  .tj-bar .tj-pick { flex: 0 1 10.2em; }
  html[lang="en"] .tj-bar .tj-pick { flex-basis: 11em; }
  .tj-bar .bk-search { flex: 1 1 0; }
}
.tj-count { margin-top: -2px; }
.tj-panel { padding: 14px 16px; }
.tj-memo { white-space: pre-wrap; font-size: var(--bk-text-sm); line-height: 1.75; }

/* ---------- progress and the photo list: tiles that wrap, never a strip that scrolls sideways ---------- */
.tj-progress-host { display: flex; flex-direction: column; gap: 10px; }
.tj-progress-host:empty { display: none; }
.tj-progress { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.tj-progress__line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 700; }
.tj-progress__line > .bk-ico { color: var(--bk-danger); }
.tj-progress__hint { font-weight: 400; }
.tj-phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px 8px; }
.tj-ph { display: flex; flex-direction: column; gap: 4px; align-items: center; min-width: 0; font-size: var(--bk-text-xs); line-height: 1.35; color: var(--bk-fg-2); text-align: center; border: 0; background: none; padding: 0; }
.tj-ph__img { position: relative; width: 72px; height: 72px; border-radius: var(--bk-r-md); overflow: hidden; background: var(--bk-bg-sunken); border: 1px solid var(--bk-line); display: grid; place-items: center; color: var(--bk-fg-3); }
.tj-ph__img img { width: 100%; height: 100%; object-fit: cover; }
.tj-ph__mark { position: absolute; right: 3px; bottom: 3px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bk-surface); box-shadow: var(--bk-shadow-1); color: var(--bk-fg-2); }
.tj-ph__mark svg { width: 13px; height: 13px; }
.tj-ph__mark .bk-spinner { width: 13px; height: 13px; border-width: 2px; }
.tj-ph__cap { max-width: 100%; overflow-wrap: anywhere; }
.tj-ph.is-done .tj-ph__mark { color: var(--bk-info); }
.tj-ph.is-failed .tj-ph__img, .tj-ph.is-other .tj-ph__img { border-color: var(--bk-danger); }
.tj-ph.is-failed .tj-ph__mark, .tj-ph.is-failed .tj-ph__cap, .tj-ph.is-other .tj-ph__mark { color: var(--bk-danger); }
.tj-ph.is-busy .tj-ph__img img { opacity: .55; }
button.tj-ph:not(:disabled):hover .tj-ph__img { border-color: var(--bk-fg-3); }

/* ---------- the board: one card per company, one row per person or material ---------- */
.tj-list { display: flex; flex-direction: column; gap: 14px; }
.tj-list > div { min-width: 0; }
.tj-company { display: flex; flex-direction: column; gap: 0; padding: 0; scroll-margin-top: calc(var(--bk-bar-h) + 12px); }
.tj-company__head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px clamp(14px, 2.4vw, 22px); }
.tj-company__id { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.tj-company__names { flex: 1 1 0; min-width: 0; }
.tj-company__name { font-size: var(--bk-text-lg); line-height: 1.45; }
.tj-company__alt { font-size: var(--bk-text-sm); line-height: 1.5; color: var(--bk-fg-3); overflow-wrap: anywhere; }
.tj-company__meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: var(--bk-text-xs); line-height: 1.6; color: var(--bk-fg-3); }
.tj-company__domain { max-width: 100%; }
.tj-next { min-width: 0; border-left: 4px solid var(--bk-accent); border-radius: 4px var(--bk-r-md) var(--bk-r-md) 4px; background: var(--bk-accent-soft); padding: 8px 12px 8px 14px; display: flex; flex-direction: column; gap: 2px; }
.tj-next__label { display: flex; align-items: center; gap: 6px; font-size: var(--bk-text-xs); font-weight: 700; letter-spacing: .06em; color: var(--bk-accent); white-space: nowrap; }
.tj-next__label .bk-ico > svg { width: 14px; height: 14px; }
.tj-next__text { font-weight: 700; line-height: 1.6; }
.tj-next .tj-inline { margin: -4px -8px; padding: 4px 8px; min-height: 40px; }
.tj-next .tj-inline:hover { background: color-mix(in srgb, var(--bk-surface) 55%, transparent); }
.tj-next.is-empty { border-left-color: var(--bk-line-strong); background: var(--bk-surface-2); }
.tj-next.is-empty .tj-next__text { font-weight: 400; color: var(--bk-fg-2); }
.tj-next.is-link { background: none; border: 0; padding: 2px 0; align-self: start; }
.tj-next.is-link .tj-note-line { align-items: center; }
.tj-note-form .bk-label { font-size: var(--bk-text-xs); color: var(--bk-fg-2); }
.tj-note-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: var(--bk-text-sm); line-height: 1.6; color: var(--bk-fg-2); }
.tj-note-line__k { font-size: var(--bk-text-xs); font-weight: 700; color: var(--bk-fg-3); }
.tj-note-line .bk-link-btn { min-height: 32px; font-size: var(--bk-text-sm); }
@media (min-width: 1100px) { .tj-company__head { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; gap: 20px; } }

.tj-rows { display: flex; flex-direction: column; }
.tj-person, .tj-material { display: grid; gap: 8px 12px; padding: 14px clamp(14px, 2.4vw, 22px); border-top: 1px solid var(--bk-line); min-width: 0;
  grid-template-columns: 96px minmax(0, 1fr) 44px;
  grid-template-areas: "thumb who edit" "contact contact contact" "status status status" "actions actions actions"; align-items: start; }
.tj-material { grid-template-areas: "thumb who edit" "contact contact contact"; }
.tj-person.is-editing { grid-template-columns: minmax(0, 1fr); grid-template-areas: "crop" "form"; background: var(--bk-surface-2); }
.tj-material.is-editing { grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "thumb form"; background: var(--bk-surface-2); }
.tj-thumbs { grid-area: thumb; display: flex; flex-direction: column; gap: 6px; }
.tj-who { grid-area: who; min-width: 0; }
.tj-contact, .tj-summary { grid-area: contact; min-width: 0; }
.tj-status { grid-area: status; min-width: 0; }
.tj-person__actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tj-person__edit { grid-area: form; min-width: 0; }
.tj-edit-crop { grid-area: crop; max-width: 460px; }
.tj-edit { grid-area: edit; display: flex; justify-content: flex-end; margin: -6px -6px 0 0; }
.tj-material .tj-crop { aspect-ratio: 3 / 4; }

.tj-person__name { font-size: var(--bk-text-md); line-height: 1.5; font-weight: 700; overflow-wrap: anywhere; }
.tj-person__name > span:first-child { white-space: nowrap; }
.tj-reading { font-size: var(--bk-text-xs); font-weight: 400; color: var(--bk-fg-3); white-space: nowrap; }
.tj-role { font-size: var(--bk-text-sm); line-height: 1.55; color: var(--bk-fg-2); }
.tj-kind { display: flex; align-items: center; gap: 5px; font-size: var(--bk-text-xs); line-height: 1.5; color: var(--bk-fg-3); }
.tj-kind .bk-ico > svg { width: 14px; height: 14px; }
.tj-material__title { font-size: var(--bk-text-md); line-height: 1.5; font-weight: 700; overflow-wrap: anywhere; }
.tj-contact { display: flex; flex-wrap: wrap; gap: 1px 18px; font-size: var(--bk-text-sm); line-height: 1.6; align-content: flex-start; }
.tj-field { display: flex; gap: 8px; align-items: flex-start; padding: 2px 6px; margin-inline: -6px; border-radius: 6px; min-width: 0; flex: 1 1 100%; }
.tj-field--phone, .tj-field--mobile { flex: 0 1 auto; } /* the two numbers share a line when there is room */
.tj-field > .bk-ico, .tj-unsure-btn > .bk-ico { color: var(--bk-fg-3); height: 1.6em; align-items: center; flex-shrink: 0; }
.tj-field .bk-ico > svg { width: 15px; height: 15px; }
.tj-field__v { min-width: 0; flex: 0 1 auto; }
.tj-field--website .tj-field__v { display: flex; min-width: 0; overflow: hidden; }
.tj-field__url { display: block; max-width: 100%; }
.tj-field__k { color: var(--bk-fg-3); }
.tj-field.is-unsure { background: var(--bk-warn-soft); }
.tj-field.is-unsure .bk-ico { color: var(--bk-warn); }
.tj-unsure-btn { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; display: flex; gap: 8px; align-items: flex-start; width: 100%; min-height: 28px; min-width: 0; }
@media (pointer: coarse) { .tj-unsure-btn { min-height: 44px; align-items: center; } }
.tj-state { display: inline-flex; align-items: center; gap: 8px; font-size: var(--bk-text-xs); font-weight: 700; color: var(--bk-ok); min-height: 28px; }
.tj-stamped { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; color: var(--bk-ok); }
.tj-stamped .bk-stamp { width: 44px; height: 44px; }
.tj-summary { font-size: var(--bk-text-sm); line-height: 1.75; }
.tj-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tj-facts li { font-size: var(--bk-text-xs); line-height: 1.5; padding: 3px 10px; border-radius: var(--bk-r-pill); background: var(--bk-bg-sunken); color: var(--bk-fg-2); overflow-wrap: anywhere; }
.tj-facts .tj-facts__more { background: none; padding: 0; }
.tj-facts__more .bk-link-btn { min-height: 28px; padding: 0 6px; font-size: var(--bk-text-xs); }
/* on a touch screen the small text links get a 44 px tap area without taking more room on the page */
@media (pointer: coarse) {
  .tj-notice .bk-link-btn, .tj-note-line .bk-link-btn, .tj-facts__more .bk-link-btn { position: relative; }
  .tj-notice .bk-link-btn::after, .tj-note-line .bk-link-btn::after, .tj-facts__more .bk-link-btn::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }
}

/* tablet: actions beside the status */
@media (min-width: 760px) {
  .tj-person { grid-template-columns: 112px minmax(0, .85fr) minmax(0, 1.25fr) 44px; grid-template-areas: "thumb who contact edit" "thumb status actions actions"; }
  .tj-material { grid-template-columns: 112px minmax(0, 1fr) minmax(0, 1.6fr) 44px; grid-template-areas: "thumb who contact edit"; }
  .tj-person .tj-person__actions { justify-content: flex-end; flex-wrap: nowrap; }
  .tj-status { align-self: center; }
  .tj-person.is-editing { grid-template-columns: minmax(240px, 400px) minmax(0, 1fr); grid-template-areas: "crop form"; }
  .tj-edit-crop { position: sticky; top: calc(var(--bk-bar-h) + 12px); align-self: start; }
}
/* desktop: one line per person. Status and actions have columns of a fixed width, so they line up and never crowd a name or a number. */
@media (min-width: 1100px) {
  /* the actions column is as wide as its two buttons need (「確認済みにする」「お礼メール」, "Mark checked" "Email draft") */
  .tj-board .tj-person { grid-template-columns: 128px minmax(0, 1fr) minmax(0, 1.3fr) 11.5em 22em 44px; grid-template-areas: "thumb who contact status actions edit"; gap: 10px 16px; }
  .tj-board .tj-material { grid-template-columns: 128px minmax(0, 1fr) minmax(0, 2fr) 44px; gap: 10px 16px; }
  .tj-board .tj-edit { margin: 0; }
  .tj-board .tj-status { padding-top: 2px; align-self: start; }
  .tj-board .tj-person .tj-person__actions { align-self: start; }
  .tj-board .tj-person.is-editing { grid-template-columns: minmax(280px, 440px) minmax(0, 1fr); grid-template-areas: "crop form"; }
}
/* one line per person only from 1280 px, so the contact column keeps room for an email */
@media (min-width: 1100px) and (max-width: 1279px) {
  .tj-board .tj-person { grid-template-columns: 128px minmax(0, .85fr) minmax(0, 1.25fr) 44px; grid-template-areas: "thumb who contact edit" "thumb status actions actions"; }
  .tj-board .tj-status { padding-top: 0; align-self: center; }
}
@media (max-width: 759px) {
  .tj-person__actions .bk-btn:not(.bk-btn--icon) { flex: 1 1 auto; padding-inline: 14px; }
}

.tj-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
@media (min-width: 720px) { .tj-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tj-form .is-wide { grid-column: 1 / -1; } }
.tj-form__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tj-field-warn .bk-input { border-color: var(--bk-warn); background: var(--bk-warn-soft); }

.tj-more { border-top: 0; padding: 16px 0 0; }
.tj-foot { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.tj-foot p { display: flex; align-items: center; gap: 6px; }

/* ---------- dialogs: the dialog is the one box that scrolls ---------- */
dialog.tj-dialog-wide { width: min(1240px, calc(100% - 32px)); max-width: none; max-height: 92dvh; }
dialog.tj-dialog-mid { width: min(720px, calc(100% - 32px)); max-height: 92dvh; }
.tj-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tj-dialog__head h2, .tj-dialog__head h3 { line-height: 1.5; padding-top: 8px; min-width: 0; overflow-wrap: anywhere; }
.tj-dialog__head .bk-btn { flex-shrink: 0; }
.tj-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tj-view { margin: 0; min-width: 0; }
.tj-view img { width: 100%; height: auto; border-radius: var(--bk-r-md); border: 1px solid var(--bk-line); background: var(--bk-bg-sunken); }
/* a pamphlet photo (no cards) never makes the dialog scroll on a short window */
@media (min-width: 900px) { .tj-review-grid.is-plain .tj-view img { width: auto; max-width: 100%; max-height: calc(92dvh - 270px); } }
/* two-line fields that grow as you type start at two lines, not at the kit's 112 px */
.bk-textarea[rows="2"] { min-height: calc(2 * 1.7em + 22px); }
@media (max-width: 560px) { dialog.tj-dialog-wide, dialog.tj-dialog-mid { width: 100%; } }

/* the comparison: the whole photo as a small map with numbered outlines, every card cut out beside its details */
.tj-review-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .tj-review-grid { grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); }
  .tj-review-map { position: sticky; top: 0; }
}
.tj-review-map { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* the photo view keeps its heading and × in view while the cards scroll */
.tj-review-dialog .tj-dialog__head { position: sticky; top: 0; z-index: 3; background: var(--bk-surface); margin: calc(-1 * clamp(20px, 4vw, 28px)) calc(-1 * clamp(20px, 4vw, 28px)) 0; padding: clamp(12px, 3vw, 18px) clamp(20px, 4vw, 28px) 8px; }
@media (min-width: 900px) { .tj-review-dialog .tj-review-map { top: 72px; } }
.tj-review-dialog .tj-review__item { scroll-margin-top: 84px; }
.tj-review-map__tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tj-map { position: relative; border-radius: var(--bk-r-md); overflow: hidden; border: 1px solid var(--bk-line); background: var(--bk-bg-sunken); }
.tj-map > img { width: 100%; height: auto; display: block; }
@media (max-width: 899px) { .tj-map { max-width: 320px; } }
.tj-mark { position: absolute; border: 2px solid color-mix(in srgb, var(--bk-accent) 70%, transparent); border-radius: 4px; background: none; padding: 0; min-width: 0; }
.tj-mark span { position: absolute; left: -2px; top: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px 0 6px 0; background: var(--bk-accent); color: var(--bk-accent-ink); font: 700 var(--bk-text-xs)/20px var(--bk-font-latin); text-align: center; }
/* the card being looked at: a strong outline with a light ring, the others stay thin */
.tj-mark.is-current { border: 3px solid var(--bk-accent); background: color-mix(in srgb, var(--bk-accent) 14%, transparent); box-shadow: 0 0 0 2px var(--bk-surface); z-index: 1; }
.tj-mark.is-current span { min-width: 24px; height: 24px; font-size: var(--bk-text-sm); line-height: 24px; left: -3px; top: -3px; }
.tj-mark.is-loose { border-style: dashed; border-color: var(--bk-fg-3); }
.tj-mark.is-loose span { background: var(--bk-fg-3); }
.tj-review { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tj-review__item { position: relative; display: grid; gap: 12px 16px; grid-template-columns: minmax(0, 1fr); padding: 14px; border: 1px solid var(--bk-line); border-radius: var(--bk-r-md); background: var(--bk-surface-2); min-width: 0; scroll-margin: 12px; }
@media (min-width: 900px) { .tj-review__item { grid-template-columns: minmax(260px, 1.15fr) minmax(0, 1fr); } .tj-review__item.is-editing { grid-template-columns: minmax(260px, .9fr) minmax(0, 1.1fr); } }
.tj-review__item.is-current { border-color: var(--bk-accent); }
.tj-review__item.is-confirmed { border-color: color-mix(in srgb, var(--bk-ok) 45%, transparent); }
.tj-review__item.is-loose { border-style: dashed; }
.tj-review__crop { position: relative; min-width: 0; }
.tj-side { position: absolute; right: 8px; top: 8px; }
.tj-num { position: absolute; left: -1px; top: -1px; z-index: var(--bk-z-sticky); min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--bk-r-md) 0 8px 0; background: var(--bk-accent); color: var(--bk-accent-ink); font: 700 var(--bk-text-sm)/28px var(--bk-font-latin); text-align: center; }
.tj-review__item.is-loose .tj-num { background: var(--bk-fg-3); }
.tj-review__item .tj-review__crop { margin-top: 18px; }
@media (min-width: 900px) { .tj-review__item .tj-review__crop { margin-top: 0; margin-left: 18px; } }
.tj-review__text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tj-review__head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; justify-content: space-between; }
.tj-review__head .tj-who { flex: 1 1 12em; }
.tj-review__company { display: flex; gap: 6px; align-items: flex-start; font-size: var(--bk-text-sm); line-height: 1.55; font-weight: 700; }
.tj-review__company .bk-ico { color: var(--bk-fg-3); height: 1.55em; align-items: center; }
.tj-review__company .bk-ico > svg { width: 15px; height: 15px; }
.tj-review__busy { display: flex; align-items: center; gap: 8px; font-size: var(--bk-text-sm); color: var(--bk-fg-2); }
.tj-review__failed { display: flex; gap: 6px; align-items: flex-start; color: var(--bk-danger); }
.tj-review .tj-form { grid-template-columns: minmax(0, 1fr); }
.tj-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tj-pager__pos { font-weight: 700; font-size: var(--bk-text-lg); }
/* a phone: the photo small, the pager beside it, so the card itself is on the first screen */
.tj-review-top { display: flex; gap: 14px; align-items: center; }
.tj-review-top .tj-map { flex: 0 0 auto; width: fit-content; max-width: none; }
.tj-review-top .tj-map > img { width: auto; height: auto; max-width: min(230px, 58vw); max-height: min(26dvh, 190px); }
.tj-review-top .tj-pager { flex: 1 1 0; display: grid; grid-template-columns: repeat(2, 44px); justify-content: center; gap: 8px; }
.tj-review-top .tj-pager__pos { grid-column: 1 / -1; grid-row: 1; text-align: center; }
.tj-review-grid.is-paged .tj-review-map__tools { justify-content: flex-start; }
.tj-review-top .tj-review-map__tools { flex: 1 1 0; flex-direction: column; align-items: flex-start; min-width: 0; }
/* one card: the photo a little smaller so the two tools fit beside it, and their labels may wrap */
.tj-review-top.is-single .tj-map > img { max-width: min(170px, 44vw); }
.tj-review-top .tj-review-map__tools .bk-btn { white-space: normal; text-align: left; min-width: 0; max-width: 100%; }
.tj-review-grid.is-plain .tj-review-map { max-width: 520px; }
/* the box editor: the photo as large as the dialog allows, the outline with four corners to drag */
.tj-review-edit { display: flex; flex-direction: column; gap: 12px; }
.tj-boxedit { display: flex; flex-direction: column; gap: 8px; }
.tj-boxedit__area { position: relative; align-self: center; width: fit-content; max-width: 100%; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.tj-boxedit__area > img { display: block; max-width: 100%; max-height: calc(92dvh - 230px); width: auto; height: auto; border-radius: var(--bk-r-md); pointer-events: none; }
.tj-boxedit__rect { position: absolute; border: 3px solid var(--bk-accent); border-radius: 4px; box-shadow: 0 0 0 9999px rgba(13, 19, 26, .45); pointer-events: none; }
.tj-boxedit__area { overflow: hidden; border-radius: var(--bk-r-md); }
.tj-boxedit__handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 0; background: none; padding: 0; display: grid; place-items: center; cursor: grab; touch-action: none; }
.tj-boxedit__handle span { width: 20px; height: 20px; border-radius: 50%; background: var(--bk-surface); border: 3px solid var(--bk-accent); box-shadow: var(--bk-shadow-2); }
.tj-boxedit__handle:focus-visible { outline: none; }
.tj-boxedit__handle:focus-visible span { outline: 3px solid var(--bk-focus); outline-offset: 2px; }
.tj-review-edit__foot { justify-content: flex-start; }

/* the thank-you draft: the email first and as tall as the dialog; the card beside it on a wide window,
   a small picture by the title on a phone (tap to see it large). The dialog is a column whose middle grows. */
dialog.tj-dialog-draft { width: min(960px, calc(100% - 32px)); max-height: 92dvh; }
dialog.tj-dialog-draft[open] { display: flex; flex-direction: column; height: min(92dvh, 860px); }
.tj-draft { flex: 1 0 auto; gap: 12px; }
.tj-draft .tj-dialog__head { align-items: center; }
.tj-draft .tj-dialog__head h3 { flex: 1 1 auto; padding-top: 0; }
.tj-draft-thumb { flex: 0 0 auto; display: grid; place-items: center; width: 66px; min-height: 44px; padding: 0; border: 0; background: none; cursor: zoom-in; }
.tj-draft-thumb .tj-crop { width: 66px; }
.tj-draft-grid { flex: 1 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 22px; }
.tj-draft-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tj-draft-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; order: 2; }
.tj-draft-big { display: none; max-width: 300px; }
dialog.is-card-open .tj-draft-big { display: block; }
dialog.is-card-open .tj-draft-side { order: 0; }
.tj-subject-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.tj-redo--wide { display: none; }
.tj-subject-row .bk-label, .tj-body-head .bk-label { margin: 0; }
.tj-subject { min-height: 46px; }
.tj-body-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tj-draft-body { flex: 1 1 auto; min-height: 9em; font-size: var(--bk-text-md); }
.tj-draft-foot { flex-wrap: nowrap; align-items: center; }
@media (min-width: 900px) {
  .tj-redo--wide { display: inline-flex; }
  .tj-redo--narrow { display: none; }
  .tj-body-head .bk-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tj-draft-grid { grid-template-columns: 250px minmax(0, 1fr); }
  .tj-draft-side { order: 0; }
  .tj-draft-big { display: block; }
  .tj-draft-thumb { display: none; }
}
@media (max-width: 560px) {
  dialog.tj-dialog-draft { width: 100%; }
  .tj-draft-foot .bk-btn { flex: 1 1 auto; padding-inline: 10px; min-width: 0; }
}

.tj-menu .bk-list__row { min-height: 64px; }

@media print { .tj-actions, .tj-bar, .tj-person__actions, .tj-progress-host, .tj-foot, .tj-notice, .tj-more { display: none !important; } }

/* Japanese inside an English page wraps by phrase too (the kit does this only when the whole page is Japanese) */
html:not([lang="ja"]) [lang="ja"] { word-break: auto-phrase; }

/* the header's light/dark button keeps its 44 px tap area on a narrow phone (the long English name gives way first) */
[data-bk-theme-toggle] { flex-shrink: 0; min-width: 44px; }
