/* Layout only: keep the existing component appearance and typography. */
.app-main, .panel, .card, .table-scroll { min-width: 0; }
.app-main { overflow-wrap: anywhere; }
.app-topbar { position: sticky; top: 0; z-index: 40; background: var(--ash); }
.site-nav { justify-content: flex-start; }
@media (min-width: 701px) {
  .site-nav { border-left: 1px solid var(--hairline); padding-left: 16px; }
}
body select:not([multiple]):not([size]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23808080' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Reserve enough room for controls instead of squeezing them into percentages.
   The description takes the remaining space; narrow screens scroll the table. */
.table-scroll { max-width: 100%; }
.table-scroll .data-table-links { min-width: 1320px; }
.data-table-links .link-col-title { width: 12%; }
.data-table-links .link-col-tags { width: 200px; }
.data-table-links .link-col-area { width: 160px; }
.data-table-links .link-col-priority { width: 116px; }
.data-table-links .link-col-date { width: 122px; }
.data-table-links .link-col-post { width: 124px; }
.data-table-links .link-col-usefulness { width: 104px; }
.data-table-links .link-col-actions { width: 80px; }
.data-table .col-desc, .data-table .col-title,
.data-table .col-tags, .data-table .col-area { overflow-wrap: anywhere; }
.data-table .col-tags, .data-table .col-area { white-space: normal; }
/* Keep labels readable; wrap whole badges rather than individual letters. */
.data-table-links .col-desc { width: auto; }
.data-table .col-tags .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.data-table .tag {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.data-table .col-tags .tag { flex: 0 1 auto; }
.data-table .priority-select { max-width: 100%; }
.data-table-links .col-title a { white-space: normal; overflow: visible; text-overflow: clip; display: block; }
/* A row may span a scrollable table; keep its editor usable on a phone. */
.data-table-links .edit-form { width: min(100%, calc(100vw - 80px)); }
.data-table:not(.data-table-links) .col-actions { white-space: normal; min-width: 160px; }
.data-table:not(.data-table-links) .col-actions > .btn { margin-bottom: 6px; }

/* Let the filters use the available line and move the add action as a unit. */
.list-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; flex: 1 1 720px; min-width: 0; }
.list-toolbar .taxonomy-filters { flex: 1 1 580px; min-width: 0; }
.taxonomy-filters > .input-field { flex: 1 1 180px; min-width: 0; }
.taxonomy-filters > select { max-width: 100%; }
.taxonomy-filters > select { text-align: center; text-align-last: center; padding-left: 30px; }
.taxonomy-filters > .tags { flex-basis: 100%; margin: 0; }
.list-toolbar > .tag-select { flex-shrink: 0; margin-left: auto; }
.channel-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.list-export { display: flex; justify-content: flex-end; }
.tag-select-menu { max-width: calc(100vw - 64px); overflow-wrap: anywhere; }
.tag-option { min-width: 0; }
.tag-option input[type="checkbox"] { flex-shrink: 0; }

/* Content in flex/grid children must be able to shrink and wrap. */
.row-actions { max-width: 100%; }
.row-title > a, .profile-row > div, .latest-issue > div,
.issue-row > div, .chart-card, .kpi-tile { min-width: 0; overflow-wrap: anywhere; }
.profile-avatar, .profile-avatar-fallback { flex-shrink: 0; }
.account-tabs, .swatch-picker, .edit-form-actions, .pagination { flex-wrap: wrap; }
.account-tabs { max-width: 100%; }
.edit-form input[type="checkbox"], .edit-form input[type="radio"] { width: auto; flex-shrink: 0; }
.edit-form, .edit-form > label, [data-save-view] > label { min-width: 0; max-width: 100%; }
[data-save-view] { align-items: flex-end; }
.under-the-hood-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.preview-dialog { overflow-y: auto; }
.preview-dialog-header { gap: 12px; }
.preview-iframe { height: min(480px, 65dvh); }
.digest-prose { white-space: normal; }
.digest-prose p { margin: 10px 0; }
.digest-prose ol,.digest-prose ul { padding-left: 24px; }

@media (max-width: 700px) {
  .site-header > *, .site-auth { min-width: 0; max-width: 100%; }
  .site-nav a { flex-shrink: 0; }
  .site-auth { flex-wrap: wrap; }
  .list-toolbar { flex-basis: 100%; position: relative; }
  .taxonomy-filters { position: relative; }
  .taxonomy-filters > .tag-select, .list-toolbar > .tag-select { position: static; }
  .taxonomy-filters > .tag-select > .tag-select-menu,
  .list-toolbar > .tag-select > .tag-select-menu {
    left: 0; right: auto; top: calc(100% + 6px);
    width: min(300px, 100%); max-width: 100%;
  }
  .list-toolbar .taxonomy-filters { flex-basis: 100%; }
  .taxonomy-filters > .input-field { max-width: 100% !important; flex-basis: 100%; }
  .tag-select-menu { min-width: 0 !important; max-width: calc(100vw - 64px); }
  .score-tooltip { width: min(220px, calc(100vw - 64px)); }
}
@media (max-width: 900px) {
  .table-scroll:has(.data-table-links) { overflow: visible; }
  .table-scroll .data-table-links { display: block; min-width: 0; width: 100%; }
  .data-table-links thead { display: none; }
  .data-table-links tbody { display: grid; gap: 10px; }
  .data-table-links tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
  .data-table-links td { display: block; width: auto; min-width: 0; padding: 7px 8px; border: 0; white-space: normal; }
  .data-table-links td::before { content: attr(data-label); display: block; color: var(--text-faint); font: 11px var(--font-mono); margin-bottom: 4px; }
  .data-table-links .col-title, .data-table-links .col-desc, .data-table-links .col-actions { grid-column: 1 / -1; }
  .data-table-links .col-title a { display: block; -webkit-line-clamp: unset; }
  .data-table-links .col-actions-stack { flex-direction: row; align-items: center; flex-wrap: wrap; }
}
