/* =============================================================================
   Page-specific styles — small, still-active, single-page rules.
   ============================================================================= */

/* -- Basic Signin page -- */
/* --- Basic Signin Page --- */
html,body { height:100%; }
.signin-center { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--color-bg-app); }
.signin-box { width:360px; background:var(--color-bg-white); border:1px solid var(--color-border); border-radius:8px; padding:1.5rem; }
.brand { display:flex; align-items:center; gap:10px; margin-bottom:1rem; }
.brand .logo { width:36px; height:36px; border-radius:6px; background:var(--color-primary); display:inline-flex; align-items:center; justify-content:center; color:var(--color-text-white); font-weight:700; }
/* Only one of the two marks on the sign-in page is ever shown. The tile they
   sit on is --color-primary, whose lightness now varies with the chosen
   palette (see Wachi.UI.applyPalette in wachi-ui.js) as well as with light/
   dark mode - so which mark reads is driven by the same "what ink suits
   this tile" signal as --color-on-accent: html[data-accent-ink="dark"],
   set whenever the active palette's onAccent is a dark color (a bright
   accent like the old gold, or an amber/lime-style palette). Default (no
   attribute) covers every accent dark enough for white content, which is
   most of them. Done in CSS rather than signin.js because that file sets
   data-theme on DOMContentLoaded, one frame too late to swap an image
   without it being seen - theme-init.js sets data-accent-ink at the same
   early point it sets data-theme. */
.brand .logo[data-theme-logo="dark"] { display: none; }
html[data-accent-ink="dark"] .brand .logo[data-theme-logo="light"] { display: none; }
html[data-accent-ink="dark"] .brand .logo[data-theme-logo="dark"]  { display: inline-flex; }

/* -- Dashboard / home widgets -- */
/* --- Dashboard/Index Page --- */
.stat-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.stat-card .stat-icon.primary { background: rgba(16, 42, 67, 0.1); color: var(--color-primary); }
.stat-card .stat-icon.success { background: rgba(30, 126, 30, 0.1); color: var(--color-status-active-fg); }
.stat-card .stat-icon.warning { background: rgba(255, 193, 7, 0.2); color: var(--color-warning-strong); }
.stat-card .stat-icon.danger { background: rgba(196, 43, 28, 0.1); color: var(--color-status-inactive-fg); }
.stat-card .stat-icon.info { background: rgba(13, 110, 253, 0.1); color: #0d6efd; }
.stat-card .stat-icon.sky { background: rgba(0, 188, 212, 0.1); color: #00bcd4; }
.stat-card .stat-icon.blue { background: rgba(0, 123, 255, 0.1); color: #007bff; }
.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
}
.stat-card .stat-change {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-card .stat-change.up { color: var(--color-status-active-fg); }
.stat-card .stat-change.down { color: var(--color-status-inactive-fg); }
.widget-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.widget-card .widget-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.widget-card .widget-header h6 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--color-text-primary);
}
.widget-card .widget-body {
  padding: 1.25rem;
}
.chart-container {
  height: 250px;
  position: relative;
}
.activity-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-item .activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.activity-item .activity-content {
  flex: 1;
  min-width: 0;
}
.activity-item .activity-title {
  font-size: 12px;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.activity-item .activity-time {
  font-size: 10px;
  color: var(--color-text-muted);
}

/* -- Detail-page image gallery (asset/product/tooling details) -- */
.detail-image-carousel {
    width: 190px;
    margin: 0 auto;
}
.detail-image-carousel .carousel-item img {
    width: 190px !important;
    height: 190px !important;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}
.carousel-control-prev, .carousel-control-next {
    width: 10%;
}

/* =============================================================================
   "sp-*" design tokens — originally scoped to .skill-profile only, promoted
   to :root so .stat-mini-card/.stat-mini-grid (the system-wide stat-card
   standard, see below) can be used on any page, not just
   skill_matrixs/skill_matrix_details.html. .skill-profile itself still
   consumes these same tokens for its own premium hero-card look; nothing
   about its rendering changed, only where the variables are declared.
   Theme-aware: light mode uses a plain white base (--color-bg-white); dark
   mode keeps the premium near-black panel look. Panel elevation is built as
   translucent tint layers OVER that single base color (never a second,
   unrelated token) so every surface is guaranteed to stay a shade of the
   same base hue. The accent follows --color-primary (navy in light mode, indigo/violet by
   default in dark mode, or whatever palette the user picked) — safe now
   that the base is white in light mode, so there's no more navy-on-navy
   collision.
   ============================================================================= */
:root {
  --sp-bg: var(--color-bg-white);
  --sp-border: var(--color-border);
  --sp-text: var(--color-text-primary);
  --sp-text-rgb: 17, 17, 17;
  --sp-muted: var(--color-text-muted);
  --sp-muted-2: var(--color-text-secondary);
  --sp-sky: var(--color-text-sky);
  --sp-accent: var(--color-primary);
  --sp-accent-rgb: var(--color-primary-rgb);
  --sp-blue-rgb: 59, 130, 246;
}

[data-theme="dark"] {
  --sp-text-rgb: 238, 243, 251;
}

.skill-profile {
  background:
      radial-gradient(circle at 18% 18%, rgba(var(--sp-blue-rgb), .16), transparent 30%),
      radial-gradient(circle at 88% 8%, rgba(var(--sp-accent-rgb), .08), transparent 22%),
      var(--sp-bg);
  border: 1px solid var(--sp-border);
  border-radius: 20px;
  padding: 18px;
  color: var(--sp-text);
  min-height: calc(100vh - 150px);
  overflow: hidden;
}

.skill-hero {
  position: relative;
  display: grid;
  grid-template-columns: 340px minmax(0,1fr) 190px;
  min-height: 390px;
  border-radius: 18px;
  overflow: hidden;
  background:
      radial-gradient(circle at 22% 55%, rgba(var(--sp-blue-rgb), .20), transparent 30%),
      linear-gradient(110deg, rgba(var(--sp-text-rgb),.02) 0%, rgba(var(--sp-text-rgb),.07) 100%),
      var(--sp-bg);
  border: 1px solid var(--sp-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 18px 50px rgba(0,0,0,.28);
  margin-bottom: 16px;
}

.skill-hero::before {
  content: "SKILL PROFILE";
  position: absolute;
  left: 22px;
  bottom: 4px;
  font-size: 5.5rem;
  line-height: .8;
  font-weight: 900;
  letter-spacing: -.06em;
  color: rgba(var(--sp-text-rgb), .05);
  pointer-events: none;
}

.skill-portrait {
  position: relative;
  min-height: 390px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background:
      radial-gradient(circle at 50% 38%, rgba(var(--sp-blue-rgb), .26), transparent 34%),
      linear-gradient(180deg, rgba(var(--sp-text-rgb), .06), transparent 60%),
      var(--sp-bg);
}

.skill-portrait::before {
  content: "";
  position: absolute;
  width: 285px;
  height: 285px;
  border: 1px solid rgba(var(--sp-accent-rgb), .35);
  border-radius: 50%;
  bottom: -105px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 45px rgba(var(--sp-accent-rgb), .12);
}

.skill-portrait::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 14px;
  border-radius: 50%;
  background: rgba(var(--sp-accent-rgb), .30);
  filter: blur(10px);
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
}

.skill-portrait-image {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 390px;
  object-fit: cover;
  object-position: center top;
  -webkit-mask-image: linear-gradient(to bottom,#000 84%,transparent 100%);
  mask-image: linear-gradient(to bottom,#000 84%,transparent 100%);
  filter: drop-shadow(0 18px 22px rgba(0,0,0,.55));
}

.skill-portrait-fallback {
  position: relative;
  z-index: 2;
  width: 210px;
  height: 290px;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  font-weight: 900;
  color: var(--sp-accent);
  background:
      linear-gradient(180deg, rgba(var(--sp-text-rgb),.10), rgba(var(--sp-text-rgb),.03)),
      var(--sp-bg);
  border: 2px solid rgba(var(--sp-accent-rgb), .65);
  clip-path: polygon(50% 0,88% 12%,100% 36%,91% 100%,9% 100%,0 36%,12% 12%);
  box-shadow: 0 18px 35px rgba(0,0,0,.45);
}

.skill-portrait-badge {
  position: absolute;
  z-index: 4;
  left: 18px;
  top: 18px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(var(--sp-accent-rgb), .38);
  color: var(--sp-accent);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  backdrop-filter: blur(8px);
}

.skill-hero-info {
  position: relative;
  z-index: 2;
  padding: 42px 28px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.skill-hero-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  background: rgba(var(--sp-blue-rgb), .16);
  border: 1px solid rgba(var(--sp-blue-rgb), .42);
  color: var(--sp-sky);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .10em;
  padding: 5px 9px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.skill-hero-info h3 {
  color: var(--sp-text);
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.02em;
}

.skill-hero-info .code {
  color: var(--sp-muted-2);
  font-weight: 700;
  font-size: .86rem;
  margin-top: 5px;
}

.skill-meta-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 9px 18px;
  margin-top: 25px;
  max-width: 620px;
}

.skill-meta-item {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--sp-text);
  font-size: .82rem;
  min-width: 0;
}

.skill-meta-item i {
  width: 18px;
  color: var(--sp-muted);
  text-align: center;
}

.skill-meta-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-hero-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--sp-accent-rgb),.35), rgba(var(--sp-text-rgb),.05), transparent);
  margin: 25px 0 17px;
  max-width: 620px;
}

.skill-hero-caption {
  color: var(--sp-muted);
  font-size: .72rem;
  letter-spacing: .05em;
}

.ovr-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  position: relative;
}

.ovr-hexagon {
  position: relative;
  width: 164px;
  height: 184px;
  clip-path: polygon(50% 0%,92% 22%,92% 78%,50% 100%,8% 78%,8% 22%);
  background:
      linear-gradient(155deg, rgba(var(--sp-text-rgb),.14), rgba(var(--sp-text-rgb),.04) 65%),
      var(--sp-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 18px rgba(var(--sp-accent-rgb),.18));
}

.ovr-hexagon::before {
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: inherit;
  background: linear-gradient(155deg, rgba(var(--sp-accent-rgb),.75), rgba(var(--sp-accent-rgb),.08) 58%, rgba(var(--sp-accent-rgb),.45));
  z-index: -1;
}

.ovr-hexagon::after {
  content: "";
  position: absolute;
  inset: 4px;
  clip-path: inherit;
  background:
      linear-gradient(155deg, rgba(var(--sp-text-rgb),.08), transparent),
      var(--sp-bg);
  z-index: -1;
}

.ovr-hexagon .ovr-label {
  font-size: .62rem;
  letter-spacing: .22em;
  color: var(--sp-muted-2);
  text-transform: uppercase;
}

.ovr-hexagon .ovr-value {
  font-size: 3.45rem;
  font-weight: 900;
  color: var(--sp-accent);
  line-height: .95;
  text-shadow: 0 3px 16px rgba(var(--sp-accent-rgb),.35);
}

.ovr-hexagon .ovr-rating {
  font-size: .72rem;
  color: var(--sp-text);
  margin-top: 7px;
  font-weight: 700;
}

.ovr-hexagon .ovr-stars {
  margin-top: 6px;
  color: var(--sp-accent);
  font-size: .72rem;
  letter-spacing: 1px;
}

/* System-wide stat-card standard (adopted from skill_matrix_details.html's
   design) - .stat-mini-grid/.stat-mini-card replace the older .stat-card
   pattern above on every page. Depends on the "sp-*" tokens declared on
   :root near the top of this file - safe to use on any page now, no
   .skill-profile wrapper required. Deliberately has no color-variant
   modifier classes (unlike .stat-card's .primary/.success/.warning/
   .danger icon backgrounds) - a single uniform muted-icon look by design;
   don't invent new variant classes for this component without checking
   back, since that wasn't part of the original skill_matrix_details look
   being standardized on. */
.stat-mini-grid {
  display: grid;
  /* auto-fit + a real minimum (not minmax(0,...)) means this responds to
     the CONTAINER's actual available width, not the viewport - a fixed
     repeat(4,minmax(0,1fr)) let columns shrink all the way to 0 whenever
     the content column was narrower than 4 comfortable cards (e.g. behind
     a sidebar, well before the old max-width:800px viewport breakpoint
     below ever fired), squeezing icon/value/label text into slivers that
     rendered as overlapping/garbled boxes. This wraps to fewer columns
     per row instead. */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat-mini-card {
  position: relative;
  background:
      linear-gradient(145deg, rgba(var(--sp-text-rgb),.09), rgba(var(--sp-text-rgb),.03)),
      var(--sp-bg);
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  overflow: hidden;
}

.stat-mini-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -28px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(var(--sp-accent-rgb),.06);
}

.stat-mini-card .stat-icon {
  font-size: .75rem;
  color: var(--sp-muted);
  margin-bottom: 7px;
}

.stat-mini-card .stat-value {
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 800;
  color: var(--sp-text);
}

.stat-mini-card .stat-label {
  font-size: .875rem;
  color: var(--sp-muted-2);
  margin-top: 6px;
}

/* การ์ดที่เป็นปุ่มกรอง (renderStatCards 'filter') - หน้าตาเดียวกับการ์ดปกติ ต่างแค่กดได้และบอกว่ากำลังกรองอยู่
   ด้วยเส้นขอบสีเน้น + เงา ไม่ใช่สีพื้นต่อสถานะ (ดูหมายเหตุ "no color-variant" ข้างบน) */
button.stat-mini-card {
  width: 100%;
  font: inherit;
  color: inherit;
}
.stat-mini-card.stat-filter {
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat-mini-card.stat-filter:hover {
  border-color: rgba(var(--sp-accent-rgb), .45);
  transform: translateY(-1px);
}
.stat-mini-card.stat-filter.is-active {
  border-color: rgb(var(--sp-accent-rgb));
  box-shadow: 0 0 0 2px rgba(var(--sp-accent-rgb), .25);
}
.stat-mini-card.stat-filter.is-active .stat-icon {
  color: rgb(var(--sp-accent-rgb));
}

.skill-panel {
  background:
      linear-gradient(145deg, rgba(var(--sp-text-rgb),.06), rgba(var(--sp-text-rgb),.02)),
      var(--sp-bg);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  height: 100%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.skill-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--sp-border);
}

.skill-panel-header h6 {
  color: var(--sp-text);
  margin: 0;
  font-weight: 750;
  font-size: .86rem;
}

.skill-panel-header .badge-scale {
  font-size: .65rem;
  background: rgba(var(--sp-text-rgb),.08);
  color: var(--sp-muted-2);
  padding: 4px 8px;
  border-radius: 999px;
}

.skill-panel-body { padding: 14px; }

.skill-list-scroll {
  max-height: 310px;
  overflow-y: auto;
  padding-right: 3px;
}

.skill-item-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(var(--sp-text-rgb),.03);
  border: 1px solid rgba(var(--sp-text-rgb),.07);
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 8px;
  transition: border-color .15s ease, transform .15s ease;
}

.skill-item-card:hover {
  border-color: rgba(var(--sp-accent-rgb),.30);
  transform: translateX(2px);
}

.skill-item-card:last-child { margin-bottom: 0; }

.skill-item-level {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  color: #08101b;
  flex-shrink: 0;
  box-shadow: 0 5px 12px rgba(0,0,0,.2);
}

.skill-item-body { flex: 1; min-width: 0; }

.skill-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}

.skill-item-title-row .name {
  color: var(--sp-text);
  font-weight: 650;
  font-size: .82rem;
}

.skill-item-tag {
  font-size: .61rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 999px;
  color: #08101b;
  white-space: nowrap;
}

.skill-item-notes {
  color: var(--sp-muted-2);
  font-size: .70rem;
  margin-top: 4px;
  line-height: 1.4;
}

.skill-item-requirement {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.skill-item-requirement .req-text {
  font-size: .68rem;
  color: var(--sp-muted-2);
  font-weight: 600;
}

.skill-gap-badge {
  font-size: .58rem;
  padding: 2px 7px;
}

.skill-level-bar {
  height: 4px;
  margin-top: 7px;
  border-radius: 99px;
  background: rgba(var(--sp-text-rgb),.10);
  overflow: hidden;
}

.skill-level-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

/* Skill level 1-5 colors — fixed status colors (not theme tokens); dark badge
   text is intentional since backgrounds are always bright regardless of theme.
   Level 0 = required skill the worker doesn't have at all; themed, not fixed,
   since it's a neutral/empty state rather than a status color. */
.skill-item-level.level-0, .skill-item-tag.level-0 { background: rgba(var(--sp-text-rgb),.12); color: var(--sp-muted); }
.skill-level-bar > span.level-0 { width: 0%; }
.skill-item-level.level-1, .skill-item-tag.level-1, .skill-level-bar > span.level-1 { background: #adb5bd; }
.skill-item-level.level-2, .skill-item-tag.level-2, .skill-level-bar > span.level-2 { background: #0dcaf0; }
.skill-item-level.level-3, .skill-item-tag.level-3, .skill-level-bar > span.level-3 { background: #4d94ff; }
.skill-item-level.level-4, .skill-item-tag.level-4, .skill-level-bar > span.level-4 { background: #ffc107; }
.skill-item-level.level-5, .skill-item-tag.level-5, .skill-level-bar > span.level-5 { background: #3ddc84; }
.skill-level-bar > span.level-1 { width: 20%; }
.skill-level-bar > span.level-2 { width: 40%; }
.skill-level-bar > span.level-3 { width: 60%; }
.skill-level-bar > span.level-4 { width: 80%; }
.skill-level-bar > span.level-5 { width: 100%; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 0 25px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(var(--sp-text-rgb),.07);
  font-size: .78rem;
}

.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--sp-muted-2); }
.info-row .value { color: var(--sp-text); font-weight: 650; text-align: right; }

@media (max-width: 1100px) {
  .skill-hero { grid-template-columns: 270px minmax(0,1fr); }
  .ovr-wrap { position: absolute; right: 10px; top: 10px; transform: scale(.82); transform-origin: top right; }
  .skill-hero-info { padding-right: 155px; }
}

@media (max-width: 800px) {
  .skill-hero { grid-template-columns: 1fr; }
  .skill-portrait { min-height: 310px; }
  .skill-portrait-image { min-height: 310px; }
  .ovr-wrap { position: absolute; right: 5px; top: 5px; }
  .skill-hero-info { padding: 20px; padding-top: 8px; }
  .skill-meta-grid { grid-template-columns: 1fr; }
  .stat-mini-grid { grid-template-columns: repeat(2,1fr); }
  .info-grid { grid-template-columns: 1fr; }
}

/* -- Schedule Event add/edit offcanvas: attendee picker -- */
/* Worker avatars in the carousel-select attendee picker read better as small
   circular badges than the component's default large rectangular photo card. */
#attendee_workerids .carousel-select-card { flex-basis: 92px; }
#attendee_workerids .carousel-select-img {
  height: 56px;
  width: 56px;
  margin: 10px auto 0;
  border-radius: var(--radius-full);
  background: var(--color-bg-surface);
}
#attendee_workerids .carousel-select-img img { border-radius: var(--radius-full); }
#attendee_workerids .carousel-select-body { text-align: center; padding: .25rem .4rem .5rem; }
#attendee_workerids .carousel-select-status { display: block; margin-top: 2px; }

/* -- Detail-page gallery: theme-aware well + quiet carousel controls.
   The main image sat in a hardcoded Bootstrap .bg-light box (a white
   square in dark mode) with the stock carousel chevrons; the summary
   heading used .text-info (a turquoise that exists in no token). -- */
.detail-image-carousel .carousel-inner {
    background: var(--color-bg-header) !important;
    border-color: var(--color-border) !important;
}
.detail-image-carousel .carousel-control-prev-icon,
.detail-image-carousel .carousel-control-next-icon {
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, .5);
    border-radius: var(--radius-full);
    background-size: 55%;
}
.detail-summary-title {
    font-size: var(--font-size-title);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
}
/* Summary facts: label above value so "Fortinet" / "FG-60E" are no
   longer anonymous strings the reader has to decode from an icon. */
.detail-summary-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-8) var(--space-12);
}
.detail-summary-fact { display: flex; align-items: flex-start; gap: var(--space-5); min-width: 0; }
.detail-summary-fact > i {
    flex-shrink: 0;
    margin-top: 2px;
    width: 14px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--icon-size-sm);
}
.detail-summary-fact-label {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    line-height: 1.3;
}
.detail-summary-fact-value {
    display: block;
    font-size: var(--font-size-md);
    color: var(--color-text-primary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Tickets queue - an overdue row should be obvious before you
   read any of its columns. Tinted background rather than bold
   text, so the priority and status badges still stand out.
   ============================================================ */
.ticket-row-breached {
    background-color: rgba(220, 53, 69, 0.08) !important;
}
.ticket-row-breached:hover {
    background-color: rgba(220, 53, 69, 0.14) !important;
}
.ticket-row-due-soon {
    background-color: rgba(255, 193, 7, 0.10) !important;
}
.ticket-row-due-soon:hover {
    background-color: rgba(255, 193, 7, 0.18) !important;
}

#TICKET_QUEUES .queue-chip.active {
    box-shadow: inset 0 0 0 2px currentColor;
    font-weight: 600;
}

/* ============================================================
   Ticket detail

   These lived in a <style> block inside ticket_details.html, which
   meant page-specific rules were re-sent on every request and could
   not be overridden by the dark theme.
   ============================================================ */

/* The one line that says how bad this ticket is. */
.ticket-strip { background: var(--bs-tertiary-bg, rgba(0, 0, 0, .03)); }
.ticket-strip .ticket-strip-sla { font-size: .85rem; }

.ticket-timeline-avatar { width: 32px; height: 32px; object-fit: cover; flex-shrink: 0; }

/* Standing open inside a form, the list scrolls on its own so it cannot push
   the fields below it off the panel. Behind a modal it must NOT - the modal
   body already scrolls, and a second scroller inside it strands the last row
   in a 220px window. */
.user-picker-inline .user-picker-list { max-height: 220px; overflow-y: auto; }

/* The reply box. Given its own surface so it reads as "write here" rather
   than as one more field in the panel above it. */
.ticket-composer { background: var(--bs-tertiary-bg, rgba(0, 0, 0, .02)); }

/* Pinned to the foot of the scrolling pane. .pane-body is the only ancestor
   that scrolls, so sticky resolves against it; the opaque background is what
   stops the conversation showing through as it passes underneath. */
.ticket-composer-dock {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--bs-body-bg, #fff);
    padding-top: .5rem;
    box-shadow: 0 -8px 12px -8px rgba(0, 0, 0, .12);
}

/* Folded, it is one line that says what it is for. */
.ticket-composer-bar { background: var(--bs-tertiary-bg, rgba(0, 0, 0, .02)); cursor: text; }
.ticket-composer-bar:hover { border-color: var(--bs-primary) !important; }

/* A status change is an event, not a message: a rule across the thread with
   the words sitting in the gap, so replies are the only things that look
   like somebody said them. */
.ticket-event-rule { flex: 1; height: 1px; background: var(--bs-border-color); }
.ticket-event-text { flex: 0 0 auto; }


/* The full-size dropzone is 30px of padding around a 2x icon - fine as the
   only thing in a panel, far too heavy sitting beside a reply box. */
.dropzone-compact { padding: 12px; }
.dropzone-compact .fa-2x { font-size: 1.25em; margin-bottom: .25rem !important; }
.dropzone-compact p { font-size: .8125rem; }

/* An internal note must not look like a reply the requester can read. */
/* The ticket as it was written: the opening message of the thread, set off
   from the replies below it. */
.ticket-body-card { background: var(--bs-tertiary-bg, rgba(0, 0, 0, .02)); }

.ticket-note-internal {
    background: var(--bs-warning-bg-subtle, #fff8e1);
    border-color: var(--bs-warning-border-subtle, #ffe69c) !important;
}

/* Avatar picker for choosing several people at once.
   Named for what it does rather than for tickets, which was the first screen to
   use it - Sale Memo's "copied to" is the second. The markup and the toggle
   behaviour live in Wachi.UI.initUserPicker(). */
.user-picker-card { width: 72px; cursor: pointer; text-align: center; }
.user-picker-avatar {
    width: 48px; height: 48px; border-radius: 50%; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: #fff; background: #adb5bd; object-fit: cover;
    border: 2px solid transparent; opacity: .55; filter: grayscale(60%);
    transition: all .15s ease; position: relative;
}
.user-picker-card.selected .user-picker-avatar {
    opacity: 1; filter: none; border-color: #198754; background: #0d6efd;
}
.user-picker-check {
    position: absolute; bottom: -2px; right: 22px; width: 18px; height: 18px;
    background: #198754; color: #fff; border-radius: 50%; font-size: 10px;
    align-items: center; justify-content: center; display: none;
}
.user-picker-card.selected .user-picker-check { display: flex; }
.user-picker-name { font-size: 11px; }

/* Folded, the picker is the row of faces you actually have - overlapping, the
   way a team is shown - with one circle on the right that opens the grid to
   add somebody. The grid of 56 people is what you open, not what you look at.
   The stack is built by the JS from the checked boxes, so it cannot drift from
   what the form will post. */
.user-picker-stack { display: flex; flex-wrap: wrap; align-items: center; min-height: 40px; }
.user-picker-stack .user-picker-avatar {
    width: 38px; height: 38px; margin: 0 0 0 -10px;
    opacity: 1; filter: none; background: #0d6efd;
    border: 2px solid var(--bs-body-bg, #fff);
}
.user-picker-stack .user-picker-avatar:first-child { margin-left: 0; }

/* The one on the right. Shows +N while faces are hidden and a plain + when
   they are all on screen, but it is the same button either way. */
.user-picker-more {
    width: 38px; height: 38px; border-radius: 50%; margin-left: -10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; cursor: pointer;
    color: var(--bs-secondary-color, #6c757d);
    background: var(--bs-secondary-bg, #e9ecef);
    border: 2px solid var(--bs-body-bg, #fff);
    transition: background .15s ease, color .15s ease;
}
.user-picker-more:hover { background: var(--bs-primary); color: #fff; }
/* -10px คือระยะที่ทำให้วงกลมซ้อนกับหน้าคนสุดท้ายพอดี แต่เมื่อยังไม่มีใครถูกเลือก
   สิ่งที่อยู่ข้างหน้าคือคำว่า "ไม่มี" - ปุ่มจึงไปทับตัวหนังสือแทน */
.user-picker-stack > :not(.user-picker-avatar) + .user-picker-more { margin-left: 0; }

/* ============================================================
   Priority matrix

   Impact down the side, urgency across the top - the shape the thing
   actually is, rather than the sixteen rows it is stored as. Cells carry a
   wash of the priority colour so the gradient across the grid is visible
   without reading a single label.
   ============================================================ */
.priority-matrix { table-layout: fixed; }
.priority-matrix th,
.priority-matrix td { vertical-align: middle; }
.priority-matrix-corner { width: 190px; background: var(--bs-tertiary-bg, rgba(0,0,0,.03)); }
.priority-matrix-axis   { width: 190px; background: var(--bs-tertiary-bg, rgba(0,0,0,.03)); }
.priority-matrix-cell   { min-width: 150px; transition: background-color .15s ease; }
.priority-matrix-select { border: 0; background-color: transparent; font-weight: 600; text-align: center; }
.priority-matrix-select:focus { background-color: var(--bs-body-bg); }

/* ============================================================
   Delivery queue - a truck over its weight limit, or one that
   cannot legally leave yet, should be obvious before any column
   is read. Same two tints the ticket queue uses for SLA, for the
   same reason: colour carries further than text.
   ============================================================ */

#DELIVERY_QUEUES .queue-chip.active {
    box-shadow: inset 0 0 0 2px currentColor;
    font-weight: 600;
}

/* ตัวเลือกผู้ช่วยขนของเคยมีคลาสของตัวเอง (.crew-picker-*) เพราะ "คนพวกนี้เป็น
   workers ไม่ใช่ users" - แต่ความต่างนั้นอยู่ที่ฐานข้อมูล ไม่ใช่ที่หน้าจอ ผลคือมี
   ตัวเลือกคนสองแบบที่หน้าตาเหมือนกันแต่พฤติกรรมไม่เหมือนกัน อันหนึ่งกางการ์ด
   170 ใบค้างไว้กลางฟอร์ม ตอนนี้ทั้งสองที่ใช้ renderUserPicker() ตัวเดียวกันแล้ว
   คลาสเก่าจึงถูกลบทิ้ง */
