/* Compact application chrome; the demonstration remains secondary. */
body[data-theme="platform"] .intro { display: none; }
body[data-theme="platform"] .shell { margin-top: 20px; }
body[data-theme="platform"] .appbar-inner { padding-block: 10px; }
body[data-theme="platform"] .tabs { padding: 4px; }
body[data-theme="platform"] .tab { min-height: 50px; padding: 8px 12px; }
body[data-theme="platform"] .tab small:empty,
body[data-theme="platform"] .panel-kicker:empty { display: none; }
body[data-theme="platform"] .tab small { font-size: .875rem; }
body[data-theme="platform"] .panel-head { margin-bottom: 18px; }
body[data-theme="platform"] .composer-collapsed .composer-head > span:last-child { display: none; }
body[data-theme="platform"] .composer-collapsed .composer-quick { grid-column: 2; }
body[data-theme="platform"] .create-form .title-field { display: none; }
body[data-theme="platform"] .post-meta + .post-body { margin-top: 16px; }
.profile-identity { display: none; }
body[data-theme="platform"] .profile-cards {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; margin-bottom: 20px;
}
body[data-theme="platform"] .profile-identity {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px;
  margin-bottom: 0; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
body[data-theme="platform"] .profile-cards .audience-preview {
  align-content: center; margin: 0; padding: 18px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
#preview-as { scroll-margin-block: 100px; }
[data-preview-link] { text-underline-offset: 3px; }
.profile-identity > div { min-width: 0; overflow-wrap: anywhere; }
.profile-identity strong, .profile-identity [data-profile-handle] { display: block; }
.profile-identity [data-profile-handle] { color: var(--muted); font-size: .875rem; }
.profile-identity button { margin-left: auto; flex-shrink: 0; }
.avatar { overflow: hidden; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.settings-avatar { width: 64px; height: 64px; }
.profile-photo-picker { display: flex; align-items: center; gap: 14px; }
.profile-photo-picker input { min-width: 0; flex: 1; }
#profile-photo-status:empty { display: none; }
#reset-explanation { display: grid; gap: 14px; }
#reset-dialog { max-height: calc(100dvh - 32px); overflow: auto; }
#reset-dialog .dialog-actions { flex-wrap: wrap; }
@media (max-width: 600px) {
  body[data-theme="platform"] .profile-cards { grid-template-columns: 1fr; }
}
.about-card {
  max-width: 760px; margin-top: 28px; padding: 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.about-card .eyebrow { font-size: .875rem; margin: 0 0 8px; }
.about-card h2 { font-size: 1.125rem; line-height: 1.4; letter-spacing: 0; }
.about-card p { font-size: .875rem; color: var(--muted); margin: 8px 0 0; }
body:not([data-theme="platform"]) .about-card { display: none; }
body[data-theme="platform"] .truth {
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
  padding: 0; border: 0; border-radius: 0; background: transparent;
}
body[data-theme="platform"] .truth > div {
  min-width: 0; padding: 12px 15px; background: var(--surface);
  border: 1px solid #e0606b; border-left-width: 4px;
}
body[data-theme="platform"] .truth > div:last-child { border-color: #e6bf55; }
@media (max-width: 540px) {
  body[data-theme="platform"] .truth { grid-template-columns: 1fr; }
}
body[data-theme="platform"][data-view="ugly"] .about-card {
  display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.5fr);
  column-gap: 24px; row-gap: 6px; align-items: start;
  max-width: none; border-left: 4px solid var(--accent); border-radius: 0;
  padding: 12px 15px;
}
body[data-theme="platform"][data-view="ugly"] .about-card .eyebrow {
  grid-column: 1; grid-row: 1; margin: 0;
  font: 650 .75rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .04em;
}
body[data-theme="platform"][data-view="ugly"] .about-card h2 {
  grid-column: 1; grid-row: 2; margin: 0; font-size: 1rem;
}
body[data-theme="platform"][data-view="ugly"] .about-card p:not(.eyebrow) {
  grid-column: 2; margin: 0;
}
body[data-theme="platform"][data-view="ugly"] .about-card p:nth-of-type(2) { grid-row: 1; }
body[data-theme="platform"][data-view="ugly"] .about-card p:nth-of-type(3) { grid-row: 2; }
@media (max-width: 700px) {
  body[data-theme="platform"][data-view="ugly"] .about-card { display: block; }
  body[data-theme="platform"][data-view="ugly"] .about-card h2,
  body[data-theme="platform"][data-view="ugly"] .about-card p:not(.eyebrow) { margin-top: 8px; }
}
#settings-dialog {
  width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  border-color: var(--border); background: var(--surface); color: var(--ink);
}
#settings-dialog .dialog-body { display: grid; gap: 22px; padding: 24px; }
.settings-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.settings-heading h2 { margin: 0; }
#settings-dialog .dialog-body p, #settings-dialog small { color: var(--muted); font-size: .875rem; line-height: 1.5; }
#settings-dialog fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 14px; min-width: 0; }
#settings-dialog legend { margin-bottom: 12px; padding: 0; font-weight: 700; }
#settings-dialog select {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit;
}
#settings-dialog .theme-selector { flex-wrap: wrap; gap: 6px; }
#settings-dialog .theme-selector > span { display: none; }
#settings-dialog .theme-selector button { border: 1px solid var(--border); font-size: .875rem; }
#settings-dialog .settings-reset { border-top: 1px solid var(--border); padding-top: 20px; }
#settings-dialog .settings-reset h3 { font-size: 1rem; margin-bottom: 6px; }
#settings-dialog #reset { margin-top: 12px; color: var(--danger); }
#settings-dialog .dialog-actions { position: sticky; bottom: 0; background: var(--surface); border-color: var(--border); padding: 16px 24px; }
#settings-dialog .dialog-actions .confirm { background: var(--accent); color: var(--bg); border-color: var(--accent); }
@media (max-width: 800px) {
  body[data-theme="platform"] .workspace { display: block; }
  body[data-theme="platform"] .workspace > .tabs { margin-bottom: 20px; }
  /* The desktop table's 9% column width must not constrain the mobile card cell. */
  body[data-theme="platform"] #db-rows tr.platform-data-row > .platform-id-cell {
    width: auto; min-width: 0;
  }
  body[data-theme="platform"] #db-rows .platform-id-cell code {
    white-space: nowrap; overflow-wrap: normal; word-break: normal;
  }
}
@media (max-width: 540px) {
  body[data-theme="platform"] .brand { width: auto; }
  body[data-theme="platform"] .header-tools { width: auto; }
  body[data-theme="platform"] .tab { padding-inline: 7px; }
  body[data-theme="platform"] .tab span { font-size: .875rem; }
  body[data-theme="platform"] .tab small { font-size: .875rem; }
  #settings-dialog .dialog-body { padding: 18px; }
  .about-card { padding: 18px; }
}

/* Collection controls share the panel's accent and stay usable on small screens. */
.collection-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.collection-switch button, .record-filter select {
  min-height: 42px; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit;
}
.collection-switch button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; box-shadow: inset 0 -2px var(--accent); }
.collection-switch button:focus-visible, .record-filter select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.record-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.record-filter label { font-weight: 700; }
#record-filter-count { color: var(--muted); font-size: .875rem; }
body .cards.photo-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cards.photo-gallery .photo-card { display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; }
.photo-gallery .entry-media-gallery { width: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; }
.photo-gallery .media-open { display: block; width: 100%; border-radius: 0; }
.photo-gallery .media-open img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.photo-gallery .photo-caption { padding: 16px; overflow-wrap: anywhere; }
.cards.photo-gallery .photo-caption h3 { margin: 0; font-size: 1rem; }
.photo-gallery .photo-caption p { margin: 6px 0 10px; font-size: .875rem; }
.photo-gallery .photo-caption small { color: var(--muted); }
.photo-gallery .post-footer { margin: auto 16px 0; padding: 12px 0 16px; flex-wrap: wrap; gap: 12px; }
.photo-gallery .post-actions { flex-wrap: wrap; margin-left: 0; }
@media (max-width: 540px) { body .cards.photo-gallery { grid-template-columns: 1fr; } }

.profile-photo-editor { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.profile-photo-editor[hidden] { display: none; }
#profile-crop-preview { display: block; width: 100%; max-height: 240px; object-fit: contain; }
.crop-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: center; }
#settings-dialog .crop-controls input[type="range"] { padding: 0; min-height: 32px; accent-color: var(--accent); }
.crop-controls button { grid-column: 1 / -1; justify-self: start; padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 6px; }
.retained-download { display: inline-grid; gap: 4px; justify-items: start; }
.retained-download small { color: var(--muted); font-size: .75rem; font-weight: 400; }
@media (max-width: 420px) { .crop-controls { grid-template-columns: 1fr; gap: 8px; } }

.retained-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; width: 100%; margin-top: 12px; }
.retained-restore, .retained-eligibility { display: grid; gap: 6px; justify-items: start; align-content: start; min-width: 0; }
.retained-actions .retained-download { justify-items: end; text-align: right; align-content: start; min-width: 0; }
.retained-actions small { display: block; font-size: .8125rem; color: var(--muted); font-weight: 400; }
.retained-actions .restore { max-width: 100%; white-space: normal; }
.retained-eligibility { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--border); }
.retained-actions button:disabled { opacity: .55; cursor: not-allowed; }
.retained-dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; color: var(--ink); background: var(--surface); border: 1px solid var(--border); }
.retained-dialog .dialog-body { padding: 24px; }
.retained-dialog .dialog-body > p { margin-top: 14px; }
.retained-dialog .dialog-actions { padding: 18px 24px; flex-wrap: wrap; border-color: var(--border); }
.retained-dialog .dialog-actions button { max-width: 100%; white-space: normal; }
.journal-database table { min-width: 1000px; }
.journal-database thead th:nth-child(1) { width: 9%; }
.journal-database thead th:nth-child(2) { width: 25%; }
.journal-database thead th:nth-child(3) { width: 11%; }
.journal-database thead th:nth-child(4) { width: 10%; }
.journal-database thead th:nth-child(5), .journal-database thead th:nth-child(6) { width: 13%; }
.journal-database thead th:nth-child(7) { width: 10%; }
.journal-database thead th:nth-child(8) { width: 9%; }
.journal-database .record-actions-button { white-space: nowrap; overflow-wrap: normal; padding-inline: 8px; }
@media (max-width: 600px) {
  .retained-actions { grid-template-columns: 1fr; }
  .retained-dialog .dialog-body { padding: 18px; }
}
.retained-dialog .dialog-body p { color: var(--muted); }
.retained-dialog .dialog-actions button { color: var(--ink); border-color: var(--border); }
.retained-dialog .dialog-actions .confirm { background: var(--accent); border-color: var(--accent); color: var(--bg); }
body[data-theme="journal"][data-view="ugly"] .retained-dialog { color-scheme: dark; --bg: #111; --surface: #171717; --ink: #f5f2eb; --muted: #bcb7ae; --accent: #efc669; --border: #454545; --soft: #28251d; }

body[data-theme="journal"] .journal-database .record-actions-button {
  min-height: 30px; padding: 3px 5px; font-size: .6875rem; line-height: 1.4;
  max-width: 100%; white-space: nowrap; letter-spacing: 0;
}
.journal-database tbody td:last-child { padding-inline: 6px; }

.dir-circulation-actions { display: grid; justify-items: start; gap: 8px; margin-top: 20px; }
.dir-circulation-actions small { color: var(--muted); font-size: .8125rem; }
