/* Components of the design that Bootstrap does not have (board "Component sheet with states"). They read only the tokens. */
.ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ic.sm { width: 14px; height: 14px; }
.ic.lg { width: 24px; height: 24px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.mono { font-family: var(--font-mono); font-size: .75rem; }
.muted { color: var(--tx2); }

/* A chip is a Bootstrap badge: icon + text + colour (never colour alone). */
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.chip .ic { width: 13px; height: 13px; stroke-width: 2; }
.c-ok { background: var(--oks); color: var(--ok); }
.c-wn { background: var(--wns); color: var(--wn); }
.c-er { background: var(--ers); color: var(--er); }
.c-in { background: var(--ins); color: var(--in); }
.c-nt { background: var(--s3); color: var(--tx2); }
.c-br { background: var(--brs); color: var(--brt); }

/* Cards used as panels of a page. */
.panel { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: var(--sh); }
.panel-body { padding: var(--pad); }
.panel-title { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }

/* Empty and error states. */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 40px 16px; color: var(--tx2); }
.empty-state .ic { width: 32px; height: 32px; color: var(--tx3); }

/* A key figure tile (dashboard). */
.kpi { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); padding: 16px; }
.kpi-label { color: var(--tx2); font-size: .8125rem; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }

/* Skeletons and spinners stop moving when the person asks for less motion. */
.sk { background: var(--s3); border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Dashboard ---- */
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-icon { width: 32px; height: 32px; border-radius: var(--r2); background: var(--brs); color: var(--brt); display: inline-flex; align-items: center; justify-content: center; }
.kpi-value { margin-top: 6px; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px var(--pad); border-top: 1px solid var(--bd); }
.item-list li:first-child { border-top: 0; }
.item-main { min-width: 0; }
.item-title { display: block; font-weight: 600; color: var(--tx); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.item-title:hover { color: var(--brt); text-decoration: underline; }
.item-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-lang { font-size: .72rem; font-weight: 700; color: var(--tx2); }
.item-time { color: var(--tx2); font-size: .78rem; white-space: nowrap; }

/* ---- Lists: filter bar, table panel, rows, and the phone card layout ---- */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filter-bar .form-select { width: auto; min-width: 150px; }
.filter-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.filter-search .form-control { padding-inline-start: 38px; }
.filter-search-icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--tx2); pointer-events: none; }
.table-panel { overflow: hidden; }
.table-panel .table-responsive { border-radius: 0; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px var(--pad); border-top: 1px solid var(--bd); font-size: .8125rem; }
.row-title { font-weight: 600; color: var(--tx); text-decoration: none; }
.row-title:hover { color: var(--brt); text-decoration: underline; }
.row-slug { display: block; color: var(--tx2); font-size: .75rem; margin-top: 2px; }
.cell-title { min-width: 220px; }
.cell-actions { white-space: nowrap; }
.author { display: inline-flex; align-items: center; gap: 8px; }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }
@media (max-width: 767.98px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px var(--pad); border-bottom: 1px solid var(--bd); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack > tbody > tr > td { height: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; background: transparent; }
  .table-stack > tbody > tr > td::before { content: attr(data-label); color: var(--tx2); font-size: .75rem; font-weight: 600; flex: none; }
  .table-stack > tbody > tr > td.cell-title { display: block; padding-top: 0; }
  .table-stack > tbody > tr > td.cell-title::before, .table-stack > tbody > tr > td.cell-actions::before { content: none; }
  .table-stack > tbody > tr > td.cell-actions { justify-content: flex-start; padding-bottom: 0; }
  .filter-bar .form-select, .filter-search { flex: 1 1 100%; max-width: none; }
}

/* ---- Page header and the editor (main column, side panels, sticky save on a phone) ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.page-head-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: min-content min-content min-content 1fr; align-content: start; column-gap: 16px; align-items: start; }
.editor-form { display: contents; }
.editor-main { grid-column: 1; grid-row: 1 / span 4; min-width: 0; }
.editor-save { grid-column: 2; grid-row: 1; min-width: 0; }
.editor-workflow-panel { grid-column: 2; grid-row: 2; min-width: 0; }
.editor-fields { grid-column: 2; grid-row: 3; min-width: 0; }
.editor-side { grid-column: 2; grid-row: 1; min-width: 0; }
.editor-publish { position: sticky; top: calc(var(--topbar-h) + 12px); }
.editor-workflow-panel .btn { width: 100%; }
.editor-workflow-panel form + form, .editor-workflow-panel .row + form { margin-top: 16px; }
.editor-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.editor-save-row { display: block; }
.panel-body > .panel-title { margin-bottom: 12px; }
@media (max-width: 991.98px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-main, .editor-save, .editor-workflow-panel, .editor-fields, .editor-side { grid-column: 1; grid-row: auto; }
  .editor-publish { position: static; }
}
@media (max-width: 767.98px) {
  .editor-grid { padding-bottom: 76px; }
  .editor-save-row { position: fixed; inset-inline: 0; bottom: 0; z-index: 1030; padding: 12px 16px; background: var(--s1); border-top: 1px solid var(--bd); box-shadow: var(--sh2); }
}

/* ---- Media library: folder tree, drop area, cards ---- */
.folder-link { padding: 7px 10px; border-radius: var(--r2); color: var(--tx); text-decoration: none; }
.folder-link:hover { background: var(--s2); }
.folder-link.active { background: var(--brs); color: var(--brt); font-weight: 600; }
.media-tree { padding-inline-start: 14px; }
.dropzone { border-style: dashed; border-color: var(--bd2); background: var(--s2); }
.media-card { background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh); }
.media-card:hover { border-color: var(--br); }
.media-card .media-thumb, .media-card .media-placeholder { border-radius: 0; background: var(--s3); color: var(--tx2); }

/* ---- Roles and audit ---- */
.panel-head { padding: 12px var(--pad); border-bottom: 1px solid var(--bd); font-weight: 600; }
.panel-body.row { margin-inline: 0; }

/* ---- Appearance screen: colour fields and the live preview (the tokens on .pv are set from appearance.js) ---- */
.color-field { display: flex; align-items: center; gap: 8px; }
.color-swatch { width: 44px; height: var(--ctl-h); padding: 2px; border: 1px solid var(--bd2); border-radius: var(--r2); background: var(--s1); cursor: pointer; flex: none; }
.preset-btn { display: inline-flex; align-items: center; gap: 6px; }
.preset-dot { width: 14px; height: 14px; border-radius: 999px; border: 1px solid var(--bd2); display: inline-block; }
.preset-dot + .preset-dot { margin-inline-start: -8px; }
.pv { border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; background: var(--bg); color: var(--tx); }
.pv-label { padding: 6px 12px; font-size: .75rem; font-weight: 600; color: var(--tx2); background: var(--s2); border-bottom: 1px solid var(--bd); }
.pv-body { display: grid; grid-template-columns: 96px minmax(0, 1fr); min-height: 150px; }
.pv-menu { background: var(--s1); border-inline-end: 1px solid var(--bd); padding: 10px 8px; }
.pv-menu-item { display: block; padding: 6px 8px; border-radius: var(--r2); background: var(--brs); color: var(--brt); font-size: .75rem; font-weight: 600; }
.pv-card { margin: 12px; padding: 12px; background: var(--s1); border: 1px solid var(--bd); border-radius: var(--r); font-size: .8125rem; }
.pv-btn { display: inline-block; padding: 5px 12px; border-radius: var(--r2); background: var(--br); color: var(--onb); font-weight: 600; font-size: .75rem; }
.pv-btn-2 { background: transparent; color: var(--tx); border: 1px solid var(--bd2); }
.pv-link { color: var(--brt); text-decoration: underline; font-size: .75rem; }

#contrast-table td[data-cell="ratio"], #contrast-table td[data-cell="need"] { white-space: nowrap; }

/* Labels printed by a stacked phone row never take the monospace font of a code cell; audit columns keep their width and scroll sideways. */
.table-stack > tbody > tr > td::before { font-family: var(--bs-body-font-family); }
.audit-table { min-width: 760px; }
.audit-table .secret-key { word-break: normal; white-space: nowrap; }
.audit-table td { vertical-align: top; }
.ltr-cell { text-align: start; unicode-bidi: isolate; word-break: break-word; }

/* ---- Picker: the "Upload from device" tab (editor image upload). Colours come from the tokens only; logical properties keep it right in both directions. */
.picker-drop { border: 2px dashed var(--bd2); border-radius: var(--r); padding: var(--sp-6) var(--sp-4); text-align: center; background: var(--s2); color: var(--tx2); transition: border-color .15s, background-color .15s; }
.picker-drop.is-over { border-color: var(--br); background: var(--brs); color: var(--tx); }
.picker-drop-text { font-weight: 600; }
.picker-upload-folder { max-inline-size: 28rem; }
.picker-upload-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding-block: var(--sp-2); padding-inline: var(--sp-3); border: 1px solid var(--bd); border-radius: var(--r2); background: var(--s1); margin-block-end: var(--sp-2); }
.picker-upload-row.is-done { border-color: var(--ok); background: var(--oks); }
.picker-upload-row.is-error { border-color: var(--er); background: var(--ers); }
.picker-upload-name { font-weight: 600; flex: 1 1 12rem; min-inline-size: 0; }
.picker-upload-status { color: var(--tx2); flex: 1 1 100%; }
.picker-upload-row.is-done .picker-upload-status { color: var(--ok); }
.picker-upload-row.is-error .picker-upload-status { color: var(--er); }
.picker-upload-progress { flex: 1 1 10rem; block-size: .5rem; accent-color: var(--br); }
@media (max-width: 575.98px) {
  .picker-drop { padding-block: var(--sp-5); padding-inline: var(--sp-3); }
  .picker-drop .btn { inline-size: 100%; }
}

/* ---- Gallery field: a grid of picture cards (thumbnail, two captions, move and remove buttons). */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--sp-3); padding: 0; margin: 0 0 var(--sp-3); list-style: none; }
.gallery-grid > .list-group-item.gallery-card { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--bd); border-radius: var(--r2); background: var(--s1); cursor: grab; }
.gallery-grid > .list-group-item.gallery-card.sortable-chosen { border-color: var(--br); box-shadow: var(--sh2); }
.gallery-grid > .list-group-item.gallery-card.sortable-ghost { opacity: .45; }
.gallery-card .gallery-card-img { inline-size: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r2); background: var(--s3); display: block; }
.gallery-card .gallery-card-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1); }
.gallery-card .gallery-card-tools .btn { min-inline-size: 2.25rem; }
.gallery-card .gallery-card-number { white-space: nowrap; margin-inline-end: auto; color: var(--tx2); font-size: .75rem; font-weight: 600; }
.gallery-empty { padding: var(--sp-5) var(--sp-4); text-align: center; border: 1px dashed var(--bd2); border-radius: var(--r); color: var(--tx2); background: var(--s2); }
.gallery-bynumber { max-inline-size: 22rem; }
@media (max-width: 575.98px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .gallery-card .gallery-card-number { flex: 1 1 100%; }
}

/* The search engine panel of the editor (FR-SEO-01): counters and the search result preview. */
.seo-counter { font-variant-numeric: tabular-nums; text-align: end; }
.seo-counter.is-short { color: var(--bs-warning-text-emphasis, #856404); }
.seo-counter.is-full { color: var(--bs-danger-text-emphasis, #842029); }
.seo-preview { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .75rem; padding: .85rem 1rem; background: var(--bs-body-bg, #fff); max-width: 42rem; }
.seo-preview__url { color: #1e7a3c; font-size: .85rem; direction: ltr; text-align: start; overflow-wrap: anywhere; }
.seo-preview__title { color: #1a0dab; font-size: 1.15rem; line-height: 1.35; margin: .15rem 0; overflow-wrap: anywhere; }
.seo-preview__desc { color: var(--bs-secondary-color, #4d5156); font-size: .9rem; overflow-wrap: anywhere; }
.seo-preview.is-empty .seo-preview__desc { font-style: italic; }
[data-theme="dark"] .seo-preview__title, :root[data-bs-theme="dark"] .seo-preview__title { color: #8ab4f8; }
[data-theme="dark"] .seo-preview__url, :root[data-bs-theme="dark"] .seo-preview__url { color: #81c995; }
