/* The Freshdesk to monday service page's own parts (T100): the first-screen picture of Freshdesk's ticket model
   (kit/FdMap.astro, ".kfdm"), the page's tool (kit/FdTool.astro, ".kfdt") and the small tag pills its tables share
   (".fdtag"). Tokens only; light and dark follow the site's. Classes only: no inline style except the entrance delay "--n". */

/* ---------- tags: what happens to a part (load, rebuilt, not listed) ---------- */
.kfdm__tag, .fdtag { display: inline-block; padding: 2px 8px; border: 1px solid var(--line-2); font-size: var(--fs-xs); line-height: 1.4; font-weight: 550; white-space: nowrap; }
.kfdm__tag--load, .fdtag--load { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-deep); }
.kfdm__tag--rebuilt, .fdtag--rebuilt { border-color: var(--warn-ink); background: var(--warn-tint); color: var(--warn-ink); }
.kfdm__tag--unlisted, .fdtag--unlisted { border-style: dashed; background: var(--paper); color: var(--muted); }

/* ---------- the first screen: Freshdesk's ticket model ---------- */
.hero__fd { align-self: center; min-width: 0; }
.kfdm { margin: 0; padding: var(--s-4) var(--s-5); border: 1px solid var(--line); background: radial-gradient(90% 60% at 0% 0%, var(--accent-tint) 0%, transparent 65%), var(--paper); box-shadow: var(--shadow-card); }
.kfdm__cap { margin: 0 0 var(--s-3); color: var(--accent-deep); }
.kfdm__lane { margin: 0 0 var(--s-2); }
.kfdm__head { margin: 0 0 var(--s-1, 4px); padding-bottom: 3px; border-bottom: 1px solid var(--line-2); color: var(--muted); font-weight: 550; }
.kfdm__lane--ticket .kfdm__head { color: var(--ok-ink); border-bottom-color: var(--ok); }
.kfdm__lane--other .kfdm__head { color: var(--accent-deep); border-bottom-color: var(--accent); }
.kfdm__rows { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.kfdm__row { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1.15fr) auto; align-items: center; gap: var(--s-2); padding: 4px 10px; border: 1px solid var(--line-2); border-left-width: 3px; background: var(--paper); font-size: var(--fs-small); line-height: 1.3; }
.kfdm__row--load { border-left-color: var(--accent); }
.kfdm__row--rebuilt { border-left-color: var(--warn-ink); }
.kfdm__row--unlisted { border-left-style: dashed; border-left-color: var(--faint); }
.kfdm__fd { font-weight: 550; color: var(--ink); overflow-wrap: anywhere; }
.kfdm__to { color: var(--ink-2); overflow-wrap: anywhere; }
.kfdm__arrow { width: 24px; height: 10px; stroke: var(--faint); }
.kfdm__tag { justify-self: end; text-align: center; }
.kfdm__thread { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px dashed var(--line-2); }
.kfdm__tk { margin: 0 0 var(--s-2); color: var(--muted); }
.kfdm__draw { display: block; width: 100%; height: auto; max-height: 76px; }
.kfdm__a { fill: var(--paper-2); stroke: var(--line-2); }
.kfdm__b { fill: var(--ok-tint); stroke: var(--ok); }
.kfdm__c { fill: var(--accent); opacity: 0.75; }
.kfdm__l { fill: none; stroke: var(--faint); stroke-width: 1.5; }
.kfdm__t { fill: var(--ink); font-size: 10px; font-weight: 600; }
.kfdm__t2 { fill: var(--ok-ink); font-size: 10px; }
.kfdm__src { margin: var(--s-3) 0 0; font-size: var(--fs-xs); line-height: 1.4; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .kfdm__slide { animation: kfdm-in 0.56s ease-out both; animation-delay: calc(var(--n, 0) * 90ms); }
}
@keyframes kfdm-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 1000px) { .hero__fd { width: 100%; max-width: 620px; margin-top: var(--s-6); } }
@media (max-width: 600px) { .hero__fd { margin-top: var(--s-2); } }
@media (max-width: 480px) {
  .kfdm { padding: var(--s-2) var(--s-3); }
  .kfdm__cap { margin-bottom: var(--s-2); }
  .kfdm__lane { margin-bottom: var(--s-2); }
  .kfdm__row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; padding: 2px 8px; line-height: 1.25; }
  .kfdm__to { grid-column: 1; grid-row: 2; font-size: var(--fs-xs); }
  .kfdm__arrow { display: none; }
  .kfdm__tag { grid-column: 2; grid-row: 1 / span 2; }
  .kfdm__thread { display: none; }
  .kfdm__rows { gap: 3px; }
  .kfdm__head { margin-bottom: 2px; }
  .kfdm__src { margin-top: var(--s-2); }
}

/* ---------- the tool: your Freshdesk account in, the monday boards and the API reads out ---------- */
.kfdt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s-6); align-items: start; }
.kfdt__form { display: grid; gap: var(--s-3); margin: 0; }
.kfdt__group { margin: 0; padding: var(--s-4) var(--s-5); border: 1px solid var(--line); background: var(--paper); min-width: 0; }
.kfdt__legend { padding: 0; color: var(--accent-deep); cursor: pointer; }
.kfdt__group[open] > .kfdt__legend { margin-bottom: var(--s-3); }
.kfdt__ex { margin: 0; color: var(--muted); }
.kfdt__ex[hidden] { display: none; }
.kfdt__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px var(--s-4); }
.kfdt__plan { display: grid; }
.kfdt__field { display: grid; grid-row: span 3; grid-template-rows: subgrid; min-width: 0; }
.kfdt__plan .kfdt__field { grid-row: auto; grid-template-rows: none; gap: 4px; }
.kfdt__field .kfdt__hint { margin-bottom: var(--s-3); }
.kfdt__label { font-size: var(--fs-small); font-weight: 550; line-height: 1.3; color: var(--ink); }
.kfdt__hint { display: block; font-size: var(--fs-xs); font-weight: 400; line-height: 1.4; color: var(--muted); }
.kfdt__num, .kfdt__sel { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font: inherit; font-size: var(--fs-body); }
.kfdt__num:hover, .kfdt__sel:hover { border-color: var(--accent); }
.kfdt__num:focus-visible, .kfdt__sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.kfdt__reset { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--s-2); border: 0; background: none; color: var(--accent-text); cursor: pointer; }
.kfdt__reset:hover { text-decoration: underline; }
.kfdt__result { position: sticky; top: calc(var(--header-h, 72px) + var(--s-4)); align-content: start; display: grid; gap: var(--s-3); padding: var(--s-5); border: 1px solid var(--line); border-top: 3px solid var(--ok); background: var(--paper); min-width: 0; }
.kfdt__kicker { margin: 0; color: var(--ok-ink); }
.kfdt__empty { margin: 0; font-size: var(--fs-small); line-height: 1.5; color: var(--muted); }
.kfdt__out { display: grid; gap: var(--s-3); }
.kfdt__out[hidden], .kfdt__empty[hidden], .kfdt__act[hidden], .kfdt__copy[hidden] { display: none; }
.kfdt.is-js .kfdt__out:not([hidden]) { animation: kfdt-in 300ms var(--ease) both; }
.kfdt__k, .kfdt__stamp { margin: 0; color: var(--muted); }
.kfdt__tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.kfdt__tile { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--ok); background: var(--ok-tint); }
.kfdt__th { font-size: var(--fs-xs); font-weight: 550; color: var(--ok-ink); }
.kfdt__big { font-size: var(--fs-h4, 1.15rem); line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.kfdt__sm { font-size: var(--fs-xs); color: var(--muted); }
.kfdt__lines { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.kfdt__line { padding: var(--s-2) var(--s-3); border-left: 3px solid var(--line-2); background: var(--paper-2); font-size: var(--fs-small); line-height: 1.5; color: var(--ink); }
.kfdt__line--trip { border-left-color: var(--warn-ink); }
.kfdt__line--note { border-left-color: var(--ok); }
.kfdt__ls { display: inline; color: var(--link-blue); text-decoration: underline; text-underline-offset: 2px; font-size: var(--fs-xs); }
.kfdt__reads { display: grid; gap: 4px; margin: 0; }
.kfdt__reads > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: baseline; padding: 6px 10px; border: 1px solid var(--line-2); background: var(--paper); }
.kfdt__reads dt { font-size: var(--fs-small); color: var(--ink-2); }
.kfdt__reads dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; }
.kfdt__reads .kfdt__plan-say { grid-column: 1 / -1; font-weight: 400; font-size: var(--fs-small); text-align: left; }
.kfdt__reads > div:last-child { grid-template-columns: minmax(0, 1fr); }
.kfdt__fine { margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--muted); }
.kfdt__act { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.kfdt__sources { margin-top: var(--s-6); }
.kfdt__sh { margin: 0 0 var(--s-3); padding: var(--s-2) 0; font-size: var(--fs-body); font-weight: 550; color: var(--accent-text); cursor: pointer; }
.kfdt__table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); line-height: 1.45; }
.kfdt__table th, .kfdt__table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.kfdt__table thead th { font-size: var(--fs-xs); font-weight: 550; color: var(--muted); }
.kfdt__table td a { color: var(--link-blue); text-decoration: underline; text-underline-offset: 2px; }
.kfdt__src { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--muted); }
@keyframes kfdt-in { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 900px) { .kfdt { grid-template-columns: minmax(0, 1fr); } .kfdt__result { position: static; } }
@media (max-width: 560px) {
  .kfdt__group { padding: var(--s-3) var(--s-4); }
  .kfdt__tiles { grid-template-columns: minmax(0, 1fr); }
  .kfdt__act .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .kfdt.is-js .kfdt__out:not([hidden]) { animation: none; }
}
