/* Clickable shortcut cards (admin/finance dashboards) */
.card-yd[data-href] {
  cursor: pointer;
}
.card-yd[data-href]:hover {
  filter: brightness(1.03);
}

/* Shared utility classes for extracted cleanup */
.yd-inline-box {
  display: inline-block;
}
.yd-text-decoration-none {
  text-decoration: none;
}
.yd-soft-sep {
  opacity: 0.5;
}
.yd-soft-sep-60 {
  opacity: 0.6;
}
.yd-opacity-75 {
  opacity: 0.75;
}
.yd-opacity-80 {
  opacity: 0.8;
}
.yd-opacity-85 {
  opacity: 0.85;
}
.yd-opacity-90 {
  opacity: 0.9;
}
.yd-lineheight-11 {
  line-height: 1.1;
}
.yd-lineheight-12 {
  line-height: 1.2;
}
.yd-lineheight-125 {
  line-height: 1.25;
}
.yd-lineheight-155 {
  line-height: 1.55;
}
.yd-mt-2 {
  margin-top: 2px;
}
.yd-mt-10 {
  margin-top: 10px;
}
.yd-mt-12 {
  margin-top: 12px;
}
.yd-font-mono-sm {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}
.yd-preview-iframe {
  width: 100%;
  height: 72vh;
  border: 0;
  background: #fff;
}
.yd-modal-content-rounded {
  border-radius: 16px;
  overflow: hidden;
}
.yd-modal-content-rounded-xl {
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.yd-modal-header-soft {
  background: linear-gradient(135deg, #eef5ff 0%, #fff 100%);
}
.yd-soft-box {
  border: 1px solid var(--border);
  background: var(--soft);
}
.yd-soft-box-dashed-info {
  border: 1px dashed var(--border);
  background: rgba(34, 211, 238, 0.06);
}
.yd-cover-frame {
  border: 1px solid var(--border);
  background: var(--soft);
}
.yd-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.yd-contain-img-pad {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}
.yd-white-space-prewrap {
  white-space: pre-wrap;
}
.yd-grid-gap-10 {
  display: grid;
  gap: 10px;
}
.yd-minw-0 {
  min-width: 0;
}
.yd-minw-220 {
  width: 220px;
}
.yd-minw-260 {
  min-width: 260px;
}
.yd-audio-full {
  width: 100%;
}
.yd-box-14 {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
}
.yd-notif-menu {
  min-width: 360px;
  max-width: 420px;
}
.yd-notif-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: #ef4444;
  vertical-align: middle;
  margin-right: 6px;
}
.yd-notif-link {
  white-space: normal;
}
.yd-notif-dot {
  font-size: 1.6rem;
  line-height: 1;
}
.yd-notif-title,
.yd-usermenu-title,
.yd-usermenu-email {
  line-height: 1.1;
}
.yd-notif-msg {
  line-height: 1.25;
}
.yd-notif-time {
  opacity: 0.8;
  margin-top: 2px;
}
.yd-usermenu {
  min-width: 240px;
}
.yd-icon-primary {
  color: var(--primary);
}
.yd-w-40p {
  width: 40%;
}
.yd-w-55p {
  width: 55%;
}
.yd-pre-soft {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  min-height: 160px;
}
.yd-kpi-chip {
  background: rgba(var(--brand-rgb), 0.1);
  border: 1px solid rgba(var(--brand-rgb), 0.18);
  color: rgba(15, 23, 42, 0.72);
}
.yd-card-accent {
  background: rgba(3, 51, 138, 0.03);
  border: 1px solid rgba(3, 51, 138, 0.1);
}
.yd-chart-300 {
  height: 300px;
}
.yd-cover-44 {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  background: #fff;
}
.yd-progress-soft {
  height: 8px;
  border-radius: 999px;
  background: rgba(3, 51, 138, 0.1);
}
.yd-table-cover-col {
  width: 68px;
}
.yd-table-country-col {
  width: 120px;
}
.yd-table-date-col {
  width: 140px;
}
.yd-table-num-col {
  width: 110px;
}
.yd-table-num-col-wide {
  width: 120px;
}
.yd-cover-52 {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1px dashed rgba(3, 51, 138, 0.25);
  overflow: hidden;
  background: #fff;
}
.yd-maxw-760 {
  max-width: 760px;
  padding: 26px;
}
.yd-maxw-820 {
  max-width: 820px;
  padding: 24px;
}
.yd-maxw-920 {
  max-width: 920px;
}
.yd-maxw-980 {
  max-width: 980px;
}
.yd-hr-soft {
  opacity: 0.12;
}
.yd-heading-reset {
  margin: 0 0 8px;
}
.yd-card-mt-14 {
  margin-top: 14px;
}
.yd-h3-reset {
  margin: 0 0 6px;
}
.yd-mt-16-8 {
  margin: 16px 0 8px;
}
.yd-th-220 {
  width: 220px;
}
.yd-th-120 {
  width: 120px;
}
.yd-inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.yd-span-patch-name {
  font-weight: 800;
}
.yd-link-top {
  margin-top: 14px;
}
.yd-helper-note {
  margin-top: 10px;
  opacity: 0.75;
}
.yd-helper-note-80 {
  margin-top: 14px;
  opacity: 0.8;
}
.yd-main-14 {
  margin-top: 14px;
}
.yd-textarea-note {
  padding-top: 28px;
}
.yd-maxh-460 {
  max-height: 460px;
  overflow: auto;
}
.yd-hide {
  display: none;
}
.yd-font-16 {
  font-size: 16px;
}
.yd-font-700 {
  font-weight: 700;
}
.yd-font-900 {
  font-weight: 900;
}

/* =============================================================
   Mobile: KPI / stat cards = 2 per row (system-wide)
   Per-page CSS drops these grids to 1 column under 768px; force
   2 columns everywhere so cards stay paired like the Tracks page.
   ============================================================= */
@media (max-width: 767.98px) {
  .yd-admin-stats,
  .yd-admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
}

/* =============================================================
   Mobile: auto-convert data tables (.table-yd) into label:value
   cards with icons. JS wraps each cell value in .yd-rwd-v and
   prepends a .yd-rwd-k label (icon + header text). System-wide.
   ============================================================= */
.yd-rwd-k { display: none; }       /* desktop: labels hidden */
.yd-rwd-v { display: contents; }   /* desktop: wrapper is transparent */

@media (max-width: 767.98px) {
  .yd-rwd-wrap { overflow: visible !important; }

  table.yd-rwd,
  table.yd-rwd > tbody { display: block; width: 100%; }
  table.yd-rwd > thead { display: none; }

  table.yd-rwd > tbody > tr {
    display: block;
    background: #fff;
    border: 1px solid rgba(15,23,42,.07);
    border-radius: 18px;
    padding: 2px 16px;
    margin-bottom: 14px;
    box-shadow: 0 10px 26px rgba(2,6,23,.06);
  }

  table.yd-rwd > tbody > tr > td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    width: auto; border: 0 !important;
    padding: 12px 0 !important;
    text-align: right;
    min-height: 30px;
  }
  table.yd-rwd > tbody > tr > td + td {
    border-top: 1px solid rgba(15,23,42,.05) !important;
  }

  /* label = icon chip + text */
  .yd-rwd-k {
    display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted, #6b7280);
  }
  .yd-rwd-k i {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--brand-rgb, 3,51,138), .10);
    color: var(--brand, #03338a); font-size: 13px;
  }
  .yd-rwd-kt { white-space: nowrap; }

  /* value */
  .yd-rwd-v {
    display: block; min-width: 0; flex: 1 1 auto; text-align: right;
    font-weight: 600; font-size: 14px; line-height: 1.35; color: var(--text, #0f172a);
    overflow-wrap: anywhere; word-break: break-word; white-space: normal;
  }
  .yd-rwd-v .small-muted { font-weight: 400; }
  .yd-rwd-v a { overflow-wrap: anywhere; word-break: break-word; }
  /* keep images / covers tidy */
  .yd-rwd-v img { max-width: 56px; max-height: 56px; height: auto; border-radius: 12px; object-fit: cover; }

  /* action buttons sit neatly on the right */
  .yd-rwd-v .action-group,
  .yd-rwd-v .btn-group { justify-content: flex-end; }

  /* ----- Cover + Title header (first column is an image) ----- */
  table.yd-rwd > tbody > tr { position: relative; }
  table.yd-rwd > tbody > tr > td.yd-rwd-cover {
    position: absolute; top: 16px; left: 16px;
    width: 52px; height: 52px; padding: 0 !important; border: 0 !important;
    justify-content: flex-start;
  }
  td.yd-rwd-cover .yd-rwd-v { display: block; width: 52px; height: 52px; flex: 0 0 auto; }
  td.yd-rwd-cover .yd-rwd-v img,
  td.yd-rwd-cover .yd-rwd-v > * {
    width: 52px !important; height: 52px !important;
    max-width: none !important; max-height: none !important;
    border-radius: 13px !important; object-fit: cover;
  }
  td.yd-rwd-cover .yd-rwd-v i { font-size: 22px; }

  /* full path beats the base "td { padding:12px 0 !important }" rule.
     left = cover(52) + gap(14) so the title sits snug next to the image */
  table.yd-rwd > tbody > tr > td.yd-rwd-title {
    border-top: 0 !important;
    padding: 14px 0 14px 66px !important;
    min-height: 58px; justify-content: flex-start;
  }
  td.yd-rwd-title .yd-rwd-v {
    text-align: left; flex: 1 1 auto;
    font-size: 15px; font-weight: 800; line-height: 1.35; color: var(--text, #0f172a);
  }
  td.yd-rwd-title .yd-rwd-v .small-muted { font-weight: 500; }

  /* rich cells (long / multi-line) → label on top, value below (left) */
  table.yd-rwd > tbody > tr > td.yd-rwd-stack {
    display: block; text-align: left;
  }
  td.yd-rwd-stack .yd-rwd-k { margin-bottom: 8px; }
  td.yd-rwd-stack .yd-rwd-v {
    display: block; width: 100%; flex: none; text-align: left; line-height: 1.5;
  }

  /* action cells (buttons) → full-width footer, buttons in a row on the right.
     Forced with !important + :has() so it beats page rules like
     ".dash-td-actions{width:1%}" and ".dash-actions{...}" regardless of JS. */
  table.yd-rwd > tbody > tr > td.yd-rwd-actions,
  table.yd-rwd > tbody > tr > td.dash-td-actions,
  table.yd-rwd > tbody > tr > td:has(.dash-actions),
  table.yd-rwd > tbody > tr > td:has(.action-group),
  table.yd-rwd > tbody > tr > td:has(> .yd-rwd-v > .btn) {
    display: block !important;
    width: 100% !important;
    padding: 12px 0 !important;
    text-align: right !important;
  }
  table.yd-rwd td.yd-rwd-actions .yd-rwd-v,
  table.yd-rwd td.dash-td-actions .yd-rwd-v,
  table.yd-rwd td:has(.dash-actions) .yd-rwd-v,
  table.yd-rwd td:has(.action-group) .yd-rwd-v {
    display: flex !important; width: 100% !important; flex: 1 1 100% !important;
    justify-content: flex-end !important; align-items: center;
    gap: 8px; flex-wrap: wrap; text-align: right;
  }
  table.yd-rwd .dash-actions,
  table.yd-rwd .action-group,
  table.yd-rwd .btn-group {
    display: flex !important; flex-direction: row !important; flex-wrap: wrap;
    justify-content: flex-end !important; align-items: center;
    gap: 8px !important; width: auto !important; margin: 0 !important;
  }
  table.yd-rwd .dash-actions .btn,
  table.yd-rwd .action-group .btn,
  table.yd-rwd td.yd-rwd-actions .btn {
    flex: 0 0 auto; margin: 0 !important; position: static !important; float: none !important;
  }
  /* action label ("ACTION") sits on its own line above the buttons in card mode —
     give it breathing room so it doesn't touch the button row */
  table.yd-rwd > tbody > tr > td.yd-rwd-actions .yd-rwd-k,
  table.yd-rwd > tbody > tr > td.dash-td-actions .yd-rwd-k,
  table.yd-rwd > tbody > tr > td:has(.dash-actions) .yd-rwd-k,
  table.yd-rwd > tbody > tr > td:has(.action-group) .yd-rwd-k {
    margin-bottom: 12px;
  }

  /* cells with no header label → value spans full width, left-aligned */
  table.yd-rwd > tbody > tr > td:not([data-th]):not(.yd-rwd-actions) { justify-content: flex-start; }
  table.yd-rwd > tbody > tr > td:not([data-th]):not(.yd-rwd-actions) .yd-rwd-v { text-align: left; flex: 1 1 100%; }

  /* empty-state row */
  table.yd-rwd > tbody > tr > td[colspan] { display: block; text-align: center; padding: 18px 0 !important; }
  table.yd-rwd > tbody > tr > td[colspan] .yd-rwd-k { display: none; }
}
