/* ==========================================================================
   Shared Components (Buttons, Badges, Progress Bar, Modals, Avatars)
   ========================================================================== */

.ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mark, .hdr-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-strong);
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand { font-size: 14.5px; line-height: 1.25; }
.brand strong { display: block; font-weight: 600; color: var(--text-primary); }
.brand span { color: var(--text-secondary); font-size: 12.5px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.ghost-btn, .btn-ghost {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover, .btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Segmented Chat | Dashboard Switcher */
.nav-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.nav-switch-item {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.nav-switch-item:hover {
  color: var(--text-primary);
}
.nav-switch-item.is-active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(11, 110, 79, 0.25);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.pill.live, .badge-live {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand-strong);
}

/* Segmented 6-Step Progress Bar (Tiosan style) */
.step-progress {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  padding: 4px 16px 8px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
}
.step-progress i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: #dbe3df;
  transition: background 0.25s ease;
}
.step-progress i.is-done { background: var(--brand); }
.step-progress i.is-now { background: linear-gradient(90deg, var(--brand) 0 45%, #dbe3df 45% 100%); }

.progress {
  height: 3px;
  background: #dbe3df;
  overflow: hidden;
  display: none;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.4s ease;
}

.prog {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.prog i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.2s ease;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 80;
}
.modal-backdrop[hidden] { display: none !important; }
.modal, .modal-card {
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-popover);
}
.modal-head strong { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-body {
  padding: 12px 20px 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.ver-pill {
  color: var(--brand-strong);
  border-color: var(--brand-border);
  background: var(--brand-soft);
  font-variant-numeric: tabular-nums;
}
.ver-entry {
  padding: 12px 14px;
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ver-entry h3, .ver-entry h4 {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ver-entry .vnum {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-strong);
  font-size: 12px;
}
.ver-date { font-weight: 500; color: var(--text-muted); font-size: 12px; }
.ver-entry ul { margin: 6px 0 0; padding-left: 18px; }
.ver-entry li { margin: 4px 0; line-height: 1.5; font-size: 13.5px; }

/* ===== v5.9 SOTA shared layer ===== */
.mark, .hdr-avatar {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(11,110,79,.28);
  letter-spacing: -.02em;
}
.ghost-btn, .btn-ghost { transition: background .15s var(--ease-out), color .15s, border-color .15s, transform .08s, box-shadow .15s; }
.ghost-btn:active, .btn-ghost:active { transform: scale(.97); }
.ghost-btn:hover, .btn-ghost:hover { box-shadow: var(--shadow-sm); }
.nav-switch { border-radius: 999px; padding: 3px; box-shadow: inset 0 1px 2px rgba(18,33,27,.04); }
.nav-switch-item { border-radius: 999px; min-height: 34px; }
.nav-switch-item.is-active { background: var(--brand-grad); box-shadow: 0 3px 10px rgba(11,110,79,.30); }
.step-progress { gap: 6px; padding: 6px 16px 10px; }
.step-progress i { height: 6px; border-radius: 99px; background: #dde6e1; }
.step-progress i.is-done { background: var(--brand); box-shadow: 0 1px 6px rgba(11,110,79,.35); }
.step-progress i.is-now { background: linear-gradient(90deg, var(--brand) 0 45%, #dde6e1 45% 100%); animation: segPulse 1.8s ease-in-out infinite; }
@keyframes segPulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.status-dot { box-shadow: 0 0 0 3px rgba(11,110,79,.15); animation: dotPulse 2.4s ease-in-out infinite; }
@keyframes dotPulse { 0%,100% { box-shadow: 0 0 0 2px rgba(11,110,79,.18); } 50% { box-shadow: 0 0 0 5px rgba(11,110,79,.06); } }
.modal, .modal-card { border-radius: var(--radius-xl); animation: modalIn .22s var(--ease-out); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-backdrop { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ver-pill { font-weight: 700; }
.ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--slate-soft); border: 1px solid var(--slate-line);
  color: var(--slate); font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
