/* TOC v7: neutral surfaces, blue actions; independent of stored subject colors. */
.toc-v7 { min-width: 0; }
.toc-v7 .section-heading { align-items: start; gap: 1rem; flex-wrap: wrap; }
.toc-v7 .section-heading > div:first-child { flex: 1 1 18rem; }
.toc-v7 .actions { flex-wrap: wrap; }
.toc-flat-list { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.toc-flat-row { display: flex; align-items: flex-start; gap: .8rem; padding: .85rem .25rem; border-bottom: 1px solid #e5e7eb; }
.toc-flat-main { min-width: 0; flex: 1; }
.toc-flat-main > strong { display: block; overflow-wrap: anywhere; color: #1f2937; }
.toc-flat-main > small { display: block; margin-top: .25rem; }
.toc-flat-row .toc-pages { margin-top: .45rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.toc-recent { margin-top: 1.25rem; border-top: 1px solid #e5e7eb; padding-top: 1rem; }
.toc-recent h3 { font-size: 1rem; margin: 0 0 .5rem; }
.toc-recent-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .3rem 0; }
.toc-recent-row > span { min-width: 0; overflow-wrap: anywhere; }
.toc-recent-row .btn { flex-shrink: 0; }
.toc-import-dialog { max-width: min(56rem, calc(100vw - 2rem)); }
.toc-import-dialog .dialog-form { max-height: 88dvh; display: flex; flex-direction: column; }
.toc-import-dialog .dialog-heading, .toc-import-dialog .dialog-footer { flex-shrink: 0; }
.toc-import-dialog .dialog-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.toc-import-dialog .dialog-footer { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #e5e7eb; z-index: 2; }
.toc-import-content { display: grid; gap: .85rem; min-width: 0; }
.toc-import-content [hidden] { display: none !important; }
.toc-import-source textarea { width: 100%; min-height: 10rem; resize: vertical; }
.toc-import-status { margin: 0; color: #334155; overflow-wrap: anywhere; }
.toc-draft-rows { display: grid; gap: .5rem; }
.toc-draft-row { display: grid; grid-template-columns: 1.7rem minmax(8rem,1fr) 6.5rem 6.5rem; align-items: end; gap: .5rem; padding: .55rem .65rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .5rem; }
.toc-draft-row .field { display: flex; flex-direction: column; min-width: 0; gap: .2rem; margin: 0; }
.toc-draft-row .field-label { font-size: .75rem; color: #64748b; }
.toc-draft-row input { width: 100%; min-width: 0; padding: .45rem .55rem; }
.toc-row-number { align-self: center; color: #64748b; font-size: .8rem; text-align: center; }
.toc-label-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.toc-file-list { display: grid; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.toc-file-list:empty, .toc-draft-rows:empty, .toc-import-warnings:empty { display: none; }
.toc-file-row { display: flex; justify-content: space-between; align-items: center; gap: .7rem; padding: .6rem; border: 1px solid #e2e8f0; border-radius: .5rem; }
.toc-file-row > div { min-width: 0; }
.toc-file-row strong { font-size: .875rem; overflow-wrap: anywhere; }
.toc-file-row small { display: block; color: #64748b; overflow-wrap: anywhere; }
.toc-file-row .actions { flex-wrap: wrap; }
.toc-file-row input[type=file], .toc-import-source input[type=file] { max-width: 100%; }
.toc-import-dialog :focus-visible, .toc-v7 :focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
@media (max-width: 600px) {
  .toc-import-dialog { max-width: calc(100vw - 1rem); width: calc(100vw - 1rem); }
  .toc-import-dialog .dialog-body { padding: .85rem; }
  .toc-draft-row { grid-template-columns: 1.3rem minmax(0,1fr) minmax(0,1fr); }
  .toc-draft-row .field:first-of-type { grid-column: 2 / 4; }
  .toc-draft-row .field:nth-of-type(2) { grid-column: 2; }
  .toc-row-number { grid-row: 1 / 3; }
  .toc-draft-row input, .toc-import-dialog textarea { font-size: 16px; }
  .toc-import-dialog .btn, .toc-v7 .btn { min-height: 42px; }
  .toc-file-row { align-items: start; flex-direction: column; }
  .toc-file-row .actions { width: 100%; }
  .toc-v7 .section-heading .actions { width: 100%; }
  .toc-v7 .section-heading .actions .btn { flex: 1 1 auto; }
}
