/* Global production polish */
:root {
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
    --scrollbar-track: transparent;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: content-box;
}

table th,
table td {
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
}

.allow-wrap,
.allow-wrap * {
    white-space: normal;
}

details > summary::-webkit-details-marker {
    display: none;
}

details[open] summary [data-lucide="chevron-down"] {
    transform: rotate(180deg);
}

summary [data-lucide="chevron-down"] {
    transition: transform 160ms ease;
}

/* Shared, readable working screens. */
[hidden] { display: none !important; }
html { overflow-wrap: anywhere; }
body { color: #1f2937; line-height: 1.55; }
main, main > *, .grid > *, .flex > * { min-width: 0; }
aside { flex-shrink: 0; }
header .rounded-full { white-space: nowrap; flex-shrink: 0; }
button, input, select, textarea { font: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { max-width: 100%; }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
button, a, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid #b45309; outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }
main p, main td, main dd { overflow-wrap: anywhere; }
main .text-gray-400 { color: #64748b; }
main .text-gray-500 { color: #586373; }
main .shadow, main .shadow-xl { box-shadow: 0 1px 3px #0f172a12; }
.reading-panel { background: white; border: 1px solid #e2e8f0; border-radius: .65rem; padding: 1.5rem; max-width: 65rem; }
.list-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; padding: 1rem; margin: 0 0 1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: .65rem; }
.list-toolbar label { display: flex; flex-direction: column; gap: .35rem; font-size: .875rem; font-weight: 600; min-width: 8rem; }
.list-toolbar label:first-child { flex: 1; min-width: min(100%, 14rem); }
.list-toolbar input, .list-toolbar select, .search-select { padding: .6rem .75rem; border: 1px solid #94a3b8; border-radius: .4rem; background: #fff; min-height: 44px; font-weight: 400; }
.button-primary, .button-secondary, .pagination a, .folder-tabs a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1rem; border-radius: .4rem; font-weight: 600; font-size: .875rem; text-align: center; }
.button-primary { background: #92400e; color: white; border: 1px solid #92400e; }
.button-primary:hover { background: #78350f; }
.button-secondary, .pagination a { background: white; color: #334155; border: 1px solid #cbd5e1; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; font-size: .875rem; }
.page-links, .action-row, .folder-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.folder-tabs { margin: 0 0 1rem; }
[aria-current=page] { background: #fef3c7 !important; color: #78350f !important; font-weight: 700; }
.table-scroll, .overflow-x-auto { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; border: 1px solid #e2e8f0; border-radius: .5rem; }
.table-scroll { max-height: 70vh; background: #fff; }
table { border-collapse: collapse; width: 100%; }
table th, table td { padding: .9rem 1rem; text-align: left; min-width: 6rem; max-width: 30rem; border-bottom: 1px solid #e2e8f0; }
table th { background: #f8fafc; color: #475569; font-weight: 600; position: sticky; top: 0; z-index: 1; }
table tbody tr:hover { background: #fffbeb; }
table th:first-child:has(input[type=checkbox]), table td:first-child:has(input[type=checkbox]) { min-width: 3rem; width: 3rem; }
.text-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; overflow-wrap: anywhere; }
.message-cell { min-width: 16rem; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1.5rem 0; line-height: 1.7; }
.status-label { display: inline-block; background: #f1f5f9; padding: .2rem .6rem; border-radius: .3rem; }
.empty-state { padding: 1rem; color: #475569; background: #f8fafc; border-radius: .4rem; }
.inline-action { display: inline; margin: 0; }
.inline-action button { text-align: inherit; }
.field-label { display: block; font-size: .875rem; font-weight: 600; color: #374151; margin-bottom: .4rem; }
.step-form { max-width: 52rem; }
.step-form > .grid, .step-panel .grid { grid-template-columns: minmax(0, 1fr) !important; }
.step-form [class*=col-span] { grid-column: auto !important; }
.step-progress { padding-bottom: 1rem; border-bottom: 1px solid #e2e8f0; margin-bottom: 1.5rem; }
.step-progress h2 { font-size: 1.15rem; font-weight: 600; }
.step-progress ol { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .75rem; color: #64748b; font-size: .875rem; }
.step-progress li[aria-current=step] { color: #92400e; font-weight: 700; }
.step-panel { display: grid; gap: 1.25rem; min-width: 0; }
.step-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.step-review { display: grid; gap: .75rem; }
.step-review dt { color: #64748b; font-size: .875rem; }
.step-review dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.search-select { display: block; width: 100%; margin: .4rem 0; }
.skip-link { position: fixed; top: -5rem; left: 1rem; background: white; padding: 1rem; z-index: 100; }
.skip-link:focus { top: 1rem; }
@media (max-width: 640px) {
  main:not(.public-main) { padding: 1rem !important; }
  main .p-8, main .p-10 { padding: 1rem; }
  header:not(.public-header) { padding: 1rem !important; gap: .75rem; }
  .list-toolbar > label { flex: 1; min-width: 7rem; }
  .list-toolbar > label:first-child { flex-basis: 100%; }
  .table-scroll { max-height: 65vh; }
  table th, table td { padding: .75rem; }
  .reading-panel { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
