/* Shared compact tags match the project key/status badges. */
.tag-picker { min-width: 0; width: 100%; }
.tag-selected, .tag-badges, .tag-overflow-items { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.tag-badges { padding: 0; border: 0; background: none; max-width: 100%; }
.project-tile-meta > .tag-badges { display: contents; }
.project-grid .tag-badge, .project-grid .tag-overflow { position: relative; z-index: 2; }
.tag-selected:empty { display: none; }
.tag-badges .tag-badge, .tag-chip, .tag-overflow > summary {
  display: inline-flex; align-items: center; gap: 5px; box-sizing: border-box; max-width: 100%; min-width: 0;
  padding: 3px 9px; border: 1px solid #cbd5e1; border-radius: 999px;
  background: #f1f5f9; color: #1e293b; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.4;
  letter-spacing: normal; text-decoration: none; white-space: normal; overflow-wrap: anywhere; vertical-align: middle;
}
.tag-badge::before, .tag-chip::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--tag-color, #64748b); box-shadow: 0 0 0 1px #64748b55; }
.tag-badges .tag-badge:hover, .tag-overflow > summary:hover, .tag-admin-edit:hover .tag-chip { background: #e2e8f0; color: #0f172a; }
.tag-badge:focus-visible, .tag-remove:focus-visible, .tag-overflow > summary:focus-visible, .tag-admin-edit:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.tag-overflow { min-width: 0; max-width: 100%; }
.tag-overflow > summary { cursor: pointer; list-style: none; }
.tag-overflow > summary::-webkit-details-marker { display: none; }
.tag-overflow[open] > summary { background: #e2e8f0; }
.tag-overflow-items { margin-top: 6px; }
.tag-input-frame { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; padding: 5px 8px; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; }
.tag-input-frame:focus-within { border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb22; }
.tag-picker .tag-input-frame .tag-input { flex: 1 1 180px; width: 0; min-width: min(180px, 100%); max-width: 100%; min-height: 32px; padding: 4px 2px; margin: 0; border: 0; border-radius: 0; background: transparent; color: #0f172a; box-shadow: none; outline: none; font-size: 14px; }
.tag-input::placeholder { color: #64748b; opacity: 1; }
.tag-input:disabled { cursor: default; }
.tag-picker .tag-selected { max-width: 100%; }
.tag-selected .tag-chip { padding-top: 0; padding-bottom: 0; padding-right: 0; min-height: 25px; }
.tag-selected .tag-chip-label { min-width: 0; padding: 3px 0; }
.tag-selected .tag-chip:not(:has(.tag-remove)) { padding-right: 9px; }
.tag-picker .tag-remove { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 24px; width: 24px; min-width: 24px; height: 24px; min-height: 24px; margin: -1px 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #475569; font-size: 16px; line-height: 1; cursor: pointer; }
.tag-picker .tag-remove:hover { background: #cbd5e1; color: #0f172a; }
.tag-picker .tag-hint { margin: 4px 0; color: #475569; font-size: 12px; line-height: 1.4; }
.tag-picker .tag-suggestions { display: block; position: static; width: 100%; max-height: min(280px, 35vh); overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; background: #fff; color: #1e293b; border: 1px solid #cbd5e1; border-radius: 8px; }
.tag-picker [hidden] { display: none !important; }
.tag-option { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 44px; box-sizing: border-box; cursor: pointer; overflow-wrap: anywhere; font-size: 14px; }
.tag-option-mark { flex: 0 0 16px; color: #2563eb; }
.tag-option-label { min-width: 0; }
.tag-option:hover, .tag-option.tag-active { background: #eff6ff; outline: 2px solid #2563eb; outline-offset: -2px; }
.tag-option[aria-selected=true] { font-weight: 600; }
.tag-option-create { color: #1d4ed8; font-weight: 600; }
.tag-picker[aria-busy=true] .tag-option { cursor: progress; opacity: .6; }
.tag-empty { margin: 0; padding: 10px 12px; font-size: 14px; color: #475569; }
.tag-message:not(:empty) { padding: 4px 0; color: #9a3412; font-size: 14px; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: start; margin: 1rem 0; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; }
.tag-filter .tag-picker { flex: 1 1 240px; }
.tag-filter select, .tag-filter button { min-height: 44px; }
.tag-filter .tag-remove { min-height: 24px; }
.tag-admin-list { display: grid; gap: .6rem; }
.tag-admin-select { display: grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.tag-admin-select input { width: 20px; height: 20px; }
#tag-admin-search { display: block; min-height: 44px; width: min(100%, 420px); margin: .5rem 0; box-sizing: border-box; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #0f172a; }
#tag-new, #tag-merge { min-height: 44px; }
.tag-admin-row[hidden] { display: none; }
.tag-admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .7rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; }
.tag-admin-edit { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.doc-card:target { outline: 3px solid #2563eb; scroll-margin-top: 70px; }
.tag-admin-dialog { background: #fff; color: #0f172a; border: 1px solid #cbd5e1; border-radius: 12px; width: min(560px, calc(100% - 3rem)); max-height: 90dvh; overflow-y: auto; }
.tag-admin-dialog::backdrop { background: #0f172a66; }
.tag-admin-dialog form { display: grid; gap: .8rem; }
.tag-admin-dialog input, .tag-admin-dialog button, .tag-admin-dialog select { min-height: 44px; max-width: 100%; min-width: 0; }
.tag-admin-dialog p { overflow-wrap: anywhere; }
