/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  transition: background 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled      { opacity: 0.5; cursor: not-allowed; }

.btn--filled  { background: var(--accent); color: var(--accent-on); }
.btn--filled:hover  { background: var(--accent-hover); color: var(--accent-on); }
.btn--filled:active { background: var(--accent-press); }

.btn--outline { border-color: var(--border-strong); color: var(--text-primary); }
.btn--outline:hover { background: var(--bg-raised); }

.btn--ghost   { color: var(--text-secondary); }
.btn--ghost:hover  { background: var(--bg-raised); color: var(--text-primary); }

.btn--danger  { background: var(--danger); color: #fff; }
.btn--danger:hover  { background: var(--danger-hover); }

.btn--sm   { padding: 4px 10px; font-size: var(--text-xs); }
.btn--full { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.form-label  { font-size: var(--text-sm); color: var(--text-secondary); font-weight: 500; }
.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: var(--text-base);
  width: 100%;
  transition: border-color 150ms ease-out;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-error         { font-size: var(--text-xs); color: var(--danger); }
.form-error--block  { margin-bottom: 12px; }
.form-hint     { font-size: var(--text-xs); color: var(--text-muted); }

.form-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body  { padding: 20px; }

/* ── Skill card (list) ─────────────────────────────────────────────────── */
.skill-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: box-shadow 150ms ease-out;
}
.skill-card:hover { box-shadow: var(--shadow-md); }
.skill-card__cover { width: 72px; height: 72px; border-radius: var(--radius-md); object-fit: cover; background: var(--bg-raised); flex-shrink: 0; }
.skill-card__body  { flex: 1; min-width: 0; }
.skill-card__title { font-weight: 600; font-size: var(--text-md); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-card__meta  { font-size: var(--text-sm); color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.skill-card__actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0;
  background: var(--bg-surface);
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table tr:nth-child(even) td { background: color-mix(in oklch, var(--bg-surface) 96%, white); }
.table tr:hover td { background: var(--bg-raised); }
.table td.actions { display: flex; gap: 6px; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
}
.badge--accent  { background: color-mix(in oklch, var(--accent) 20%, transparent); color: var(--accent); }
.badge--danger  { background: color-mix(in oklch, var(--danger) 20%, transparent); color: var(--danger); }
.badge--warning { background: color-mix(in oklch, var(--warning) 20%, transparent); color: var(--warning); }
.badge--neutral { background: var(--bg-raised); color: var(--text-secondary); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 400;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 320px;
  max-width: 480px;
  box-shadow: var(--shadow-md);
}
.modal-message { font-size: var(--text-md); margin-bottom: 20px; color: var(--text-primary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Flash toasts ──────────────────────────────────────────────────────── */
.flash-toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: #fff;
  pointer-events: auto;
  animation: flash-in 150ms ease-out;
  max-width: 320px;
  box-shadow: var(--shadow-md);
}
.flash-toast--success { background: var(--accent); }
.flash-toast--error   { background: var(--danger); }
.flash-toast--info    { background: var(--info); color: #000; }

@keyframes flash-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Drop zone ─────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 150ms ease-out, background 150ms ease-out;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, var(--bg-input));
}
.drop-zone input[type="file"] { display: none; }
.drop-zone__label { font-size: var(--text-sm); }
.drop-zone__label strong { color: var(--accent); }

/* ── Form layout ───────────────────────────────────────────────────────── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Video rows ────────────────────────────────────────────────────────── */
.video-add-row              { display: flex; gap: 10px; margin-bottom: 16px; }
.video-add-row .form-input  { flex: 1; }
.video-row                  { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.video-row__id              { flex: 1; }
.video-row__link            { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.video-row__link:hover .badge { background: color-mix(in oklch, var(--accent) 20%, transparent); color: var(--accent); }
.video-row__link:hover .video-row__id { color: var(--accent); }

/* ── Flag panel ────────────────────────────────────────────────────────── */
.flag-panel {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-width: 320px;
  z-index: 300;
  box-shadow: var(--shadow-md);
}
.flag-panel[hidden]      { display: none; }
.flag-panel__input       { margin: 8px 0; }
.flag-panel__actions     { display: flex; gap: 8px; justify-content: flex-end; }

.image-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.image-thumb {
  position: relative;
  width: 80px; height: 80px;
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-md); }
.image-thumb__remove {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff;
  border: none; border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.image-thumb__cover { margin-top: 4px; font-size: var(--text-xs); text-align: center; color: var(--text-muted); }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 20px; }
.pagination__btn { padding: 5px 12px; }
.pagination__info { font-size: var(--text-sm); color: var(--text-muted); }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state h2 { color: var(--text-secondary); margin-bottom: 8px; }

/* ── Filters bar ───────────────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.filters .form-input, .filters .form-select { width: auto; }
.form-input--w110 { width: 110px; }
.form-input--w180 { width: 180px; }
.form-input--w200 { width: 200px; }
.form-input--w220 { width: 220px; }
.form-input--w240 { width: 240px; }

/* ── Danger zone ───────────────────────────────────────────────────────── */
.danger-zone {
  margin-top: 40px;
  padding: 20px;
  border: 1px solid color-mix(in oklch, var(--danger) 30%, transparent);
  border-radius: var(--radius-lg);
}
.danger-zone h3 { color: var(--danger); margin-bottom: 8px; }
.danger-zone p  { margin-bottom: 12px; }

/* ── Skill detail ──────────────────────────────────────────────────────── */
.skill-detail-actions { display: flex; gap: 10px; margin-bottom: 20px; }
.detail-field         { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.detail-label         { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.detail-value         { font-size: var(--text-sm); color: var(--text-primary); }
.detail-description   { white-space: pre-wrap; font-size: var(--text-sm); color: var(--text-primary); line-height: 1.6; }

/* ── Image lightbox ────────────────────────────────────────────────────────── */
.image-thumb--clickable { cursor: zoom-in; }
.lightbox               { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.lightbox[hidden]       { display: none; }
.lightbox img           { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,.5); }
.lightbox__close        { position: absolute; top: 16px; right: 20px; background: none; border: none; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; opacity: .8; }
.lightbox__close:hover  { opacity: 1; }
.lightbox__prev,
.lightbox__next         { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: none; color: #fff; font-size: 3.5rem; line-height: 1; cursor: pointer; opacity: .7; padding: 0 12px; user-select: none; }
.lightbox__prev         { left: 16px; }
.lightbox__next         { right: 16px; }
.lightbox__prev:hover,
.lightbox__next:hover   { opacity: 1; }
.lightbox__prev[hidden],
.lightbox__next[hidden] { display: none; }

/* ── Searchable select ─────────────────────────────────────────────────────── */
.sc-select               { position: relative; }
.sc-select__input        { width: 100%; cursor: pointer; }
.sc-select__input.is-open { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.sc-select__dropdown     { position: absolute; z-index: 200; top: calc(100% + 4px); left: 0; right: 0;
                           background: var(--bg-input); border: 1px solid var(--border-subtle);
                           border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.4);
                           max-height: 240px; overflow-y: auto; }
.sc-select__dropdown[hidden] { display: none; }
.sc-select__option       { padding: 8px 12px; font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; }
.sc-select__option:hover,
.sc-select__option.is-active { background: color-mix(in oklch, var(--accent) 12%, var(--bg-input)); }
.sc-select__option.is-selected { color: var(--accent); }
.sc-select__empty        { padding: 10px 12px; font-size: var(--text-sm); color: var(--text-muted); }

/* ── Message thread ────────────────────────────────────────────────────────── */
.msg-thread        { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.msg-bubble        { max-width: 80%; padding: 10px 14px; border-radius: var(--radius-lg); }
.msg-bubble--admin { align-self: flex-start; background: var(--bg-raised); border: 1px solid var(--border-subtle); }
.msg-bubble--user  { align-self: flex-end; background: color-mix(in oklch, var(--accent) 10%, var(--bg-surface)); }
.msg-bubble__meta  { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 4px; }
.msg-bubble__body  { font-size: var(--text-sm); white-space: pre-wrap; }
.msg-compose       { display: flex; flex-direction: column; gap: 8px; }
