/* Lieferanten-Tab: Layout auf Basecoat-Tokens, Aufbau wie crm.css (Präfix sup-). */
main:has(#suppliers-content:not(.hidden)) { max-width: 1680px; }
#suppliers-content { max-width: none; margin: 0 auto; padding: 20px 24px 32px; display: grid; gap: 14px; }
.sup-mono { font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-variant-numeric: tabular-nums; }
.sup-muted { color: var(--color-muted-foreground); }
.sup-ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Kopfzeile + Tag-Filter */
.sup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-title { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 0 auto 0 0; display: flex; align-items: baseline; gap: 8px; }
.sup-title small { font-weight: 400; font-size: 14px; }
.sup-search { width: 260px; }
.sup-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sup-filters:empty { display: none; }
.sup-filters .btn[aria-pressed="true"] { background: var(--color-secondary); border-color: var(--color-foreground); }

/* Split: Detail ist hier der schwerere Teil (Notizen + Bestellungen) */
.sup-split { display: grid; grid-template-columns: minmax(0, 9fr) minmax(0, 11fr); gap: 16px; align-items: start; }
.sup-split.sup-drawer-mode { grid-template-columns: 1fr; }
.sup-split.sup-drawer-mode #sup-detail-card { display: none; }
.sup-main { min-width: 0; }

/* Liste */
#sup-list-view { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-card); }
.sup-table { table-layout: fixed; width: 100%; }
.sup-table td, .sup-table th { vertical-align: middle; }
.sup-table tbody tr { cursor: pointer; }
.sup-table tbody tr[data-state="selected"] td:first-child { box-shadow: inset 3px 0 0 var(--color-foreground); }
.sup-nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-sub { color: var(--color-muted-foreground); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-col-tags { width: 28%; }
.sup-col-last { width: 140px; }
.sup-col-sum { width: 150px; text-align: right; }
.sup-cell-sum { text-align: right; white-space: nowrap; }
.sup-cell-sum .sup-sub { font-size: 12px; }
.sup-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.sup-empty-row td { padding: 28px 16px; text-align: center; color: var(--color-muted-foreground); font-size: 14px; }

/* Detail */
.sup-detail-card { padding: 20px; }
.sup-detail { display: grid; gap: 22px; align-content: start; }   /* start: im Drawer sonst auf Höhe gestreckt */
.sup-detail-empty { display: grid; place-items: center; min-height: 220px; text-align: center; color: var(--color-muted-foreground); font-size: 14px; }
.sup-detail-head { display: flex; align-items: flex-start; gap: 14px; }
.sup-detail-head .sup-txt { flex: 1; min-width: 0; display: grid; gap: 8px; }
.sup-detail-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sup-head-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sup-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.sup-link { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--color-border); min-width: 0; }
.sup-link:hover { text-decoration-color: currentColor; }
.sup-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

/* Formulare */
.sup-form { display: grid; gap: 12px; }
.sup-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sup-field { display: grid; gap: 6px; min-width: 0; }
.sup-form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Abschnitte */
.sup-section { display: grid; gap: 10px; }
.sup-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sup-section-head h3 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: baseline; gap: 6px; }
.sup-section-head .sup-n { font-size: 13px; font-weight: 400; }
.sup-section-head .sup-spacer { flex: 1; }
.sup-status { font-size: 12px; white-space: nowrap; }
.sup-empty { margin: 0; font-size: 14px; }
.sup-seg { display: flex; gap: 4px; }
.sup-seg .btn[aria-pressed="true"] { background: var(--color-secondary); border-color: var(--color-foreground); }

/* Notizen */
.sup-toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
.sup-toolbar .btn { font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 12px; min-width: 34px; }
.sup-notes-editor { min-height: 320px; font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 14px; line-height: 1.5; resize: vertical; tab-size: 2; }
.sup-notes-view { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; min-height: 80px; padding: 2px; cursor: text; }
.sup-notes-view.sup-notes-empty { color: var(--color-muted-foreground); font-size: 14px; }
.sup-notes-view h1 { font-size: 22px; font-weight: 600; margin: 18px 0 8px; letter-spacing: -.01em; }
.sup-notes-view h2 { font-size: 18px; font-weight: 600; margin: 16px 0 6px; }
.sup-notes-view h3 { font-size: 15px; font-weight: 600; margin: 14px 0 4px; }
.sup-notes-view > :first-child { margin-top: 0; }
.sup-notes-view > :last-child { margin-bottom: 0; }
.sup-notes-view p { margin: 0 0 10px; }
.sup-notes-view ul, .sup-notes-view ol { margin: 0 0 10px; padding-left: 22px; }
.sup-notes-view ul { list-style: disc; }
.sup-notes-view ol { list-style: decimal; }
.sup-notes-view li { margin: 2px 0; }
.sup-notes-view li.md-task { list-style: none; margin-left: -22px; }
.sup-notes-view li.md-task label { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.sup-notes-view li.md-task input { margin: 0; cursor: pointer; width: 15px; height: 15px; flex-shrink: 0; position: relative; top: 2px; }
.sup-notes-view li.md-task input:checked + span { color: var(--color-muted-foreground); text-decoration: line-through; }
.sup-notes-view blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--color-border); color: var(--color-muted-foreground); }
.sup-notes-view code { font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: .9em; background: var(--color-secondary); padding: 1px 5px; border-radius: 4px; }
.sup-notes-view hr { border: 0; border-top: 1px solid var(--color-border); margin: 14px 0; }
.sup-notes-view a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.sup-notes-view strong { font-weight: 600; }

/* Bestellungen */
.sup-year { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 12px; color: var(--color-muted-foreground); text-transform: uppercase; letter-spacing: .06em; padding: 8px 2px 4px; border-bottom: 1px solid var(--color-border); }
.sup-year .sup-year-sum { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--color-foreground); }
.sup-year .sup-year-sum small { color: var(--color-muted-foreground); font-size: 11px; }
.sup-order { padding: 12px 14px; display: grid; gap: 10px; }
.sup-order.sup-over-drop { outline: 2px dashed var(--color-ring); outline-offset: -2px; }
.sup-order-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.sup-order-date { font-size: 13px; color: var(--color-muted-foreground); white-space: nowrap; }
.sup-order-desc { font-weight: 500; overflow-wrap: anywhere; }
.sup-order-amount { white-space: nowrap; font-weight: 500; }
.sup-order-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.sup-order:hover .sup-order-actions, .sup-order:focus-within .sup-order-actions { opacity: 1; }
@media (hover: none) { .sup-order-actions { opacity: 1; } }
.sup-order-form { gap: 12px; }

/* Dateien / Anhänge */
.sup-files { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.sup-file { position: relative; display: flex; flex-direction: column; width: 132px; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--color-background); }
.sup-file-open { display: grid; gap: 3px; cursor: pointer; padding: 0 0 8px; text-align: left; border: 0; background: none; color: inherit; font: inherit; width: 100%; }
.sup-file-open:focus-visible { outline: 2px solid var(--color-ring); outline-offset: -2px; }
.sup-thumb { width: 100%; height: 88px; object-fit: cover; display: block; background: var(--color-secondary); }
.sup-file-ico { position: relative; width: 100%; height: 88px; display: grid; place-items: center; background: var(--color-secondary); color: var(--color-muted-foreground); }
.sup-file-ico .sup-ico { width: 30px; height: 30px; stroke-width: 1.5; }
.sup-file-kind { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.sup-file-name { font-size: 12px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-file-size { font-size: 11px; padding: 0 8px; }
.sup-file-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.sup-file:hover .sup-file-actions, .sup-file:focus-within .sup-file-actions { opacity: 1; }
.sup-file-actions > * { background: color-mix(in oklab, var(--color-background) 88%, transparent); }
@media (hover: none) { .sup-file-actions { opacity: 1; } }
.sup-file-add { display: grid; place-items: center; align-content: center; gap: 4px; width: 132px; min-height: 128px; border: 1px dashed var(--color-border); border-radius: var(--radius); color: var(--color-muted-foreground); font-size: 12px; cursor: pointer; }
.sup-file-add:hover { border-color: var(--color-foreground); color: var(--color-foreground); }
.sup-upload { width: 132px; min-height: 128px; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px 8px; display: grid; align-content: end; gap: 6px; font-size: 12px; }
.sup-upload .sup-file-name { padding: 0; }
.sup-upload .sup-bar { height: 4px; background: var(--color-secondary); border-radius: 2px; overflow: hidden; }
.sup-upload .sup-bar > span { display: block; height: 100%; width: 0; background: var(--color-foreground); transition: width .2s; }
.sup-dropzone { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; border: 1px dashed var(--color-border); border-radius: var(--radius); color: var(--color-muted-foreground); font-size: 14px; text-align: center; }
.sup-dropzone.sup-over-drop { border-color: var(--color-foreground); color: var(--color-foreground); }
.sup-pending { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.sup-pending li { display: flex; align-items: center; gap: 8px; }
.sup-pending li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Drawer (schmale Viewports) */
#sup-detail-drawer > div { width: min(760px, 100vw); max-width: min(760px, 100vw); overflow-y: auto; }
#sup-detail-drawer .sup-detail { padding: 20px; }
#sup-detail-drawer .sup-detail-head { padding-right: 36px; }
#sup-detail-drawer .sup-drawer-close { position: absolute; top: 12px; right: 12px; }

/* Responsive */
@media (max-width: 1023px) {
    .sup-split { grid-template-columns: 1fr; }
    .sup-split #sup-detail-card { display: none; }
}
@media (max-width: 720px) {
    #suppliers-content { padding: 14px; }
    .sup-search { width: 100%; }
    .sup-col-tags, .sup-col-last { display: none; }
    .sup-col-sum { width: 120px; }
    .sup-form-row { grid-template-columns: 1fr; }
    .sup-order-head { grid-template-columns: auto minmax(0, 1fr); }
    .sup-order-amount { grid-column: 2; justify-self: start; }
    .sup-order-actions { grid-column: 1 / -1; justify-content: flex-end; opacity: 1; }
    .sup-link span { max-width: 200px; }
}
