:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f0f1f4;
    --border: #d9dce1;
    --text: #1f2329;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-text: #ffffff;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
    --pin-shadow: rgba(15, 23, 42, .18);
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #232830;
    --border: #333a45;
    --text: #e6e8ec;
    --text-muted: #9aa3b2;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-text: #ffffff;
    --danger: #f87171;
    --danger-hover: #ef4444;
    --success: #4ade80;
    --warning: #fbbf24;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);
    --pin-shadow: rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }

.muted { color: var(--text-muted); }

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.brand { font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }

.app-nav { display: flex; gap: 1rem; }
.app-nav a { color: var(--text-muted); }
.app-nav a.active { color: var(--primary); font-weight: 600; }

.app-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.inline-form { display: inline; }

.blank-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.auth-card-sm { max-width: 360px; }

.form-stack, .form-stack label {
    display: block;
}

.form-stack label { margin-bottom: 1rem; font-size: .9rem; color: var(--text-muted); }
.form-stack label > input,
.form-stack label > select,
.form-stack label > textarea { margin-top: .35rem; }

input[type="text"], input[type="number"], input[type="password"], input[type="date"],
input[type="datetime-local"], input[type="search"], input[type="url"], select, textarea {
    width: 100%;
    margin-top: .35rem;
    padding: .5rem .6rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}

textarea { resize: vertical; min-height: 90px; }

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.btn:hover { background: var(--border); }

.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover,
.btn-primary:focus-visible { background: var(--primary-hover); border-color: var(--primary-hover); filter: none; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover,
.btn-danger:focus-visible { background: var(--danger-hover); border-color: var(--danger-hover); color: #fff; }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: .25rem .55rem; font-size: .85rem; }

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
    text-decoration: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: .85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

.btn:disabled,
.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

.btn:disabled:hover,
.btn[disabled]:hover { background: var(--surface-2); }

.btn-primary:disabled:hover,
.btn-primary[disabled]:hover { background: var(--primary); }

.btn-danger:disabled:hover,
.btn-danger[disabled]:hover { background: var(--danger); }

.flash {
    padding: .6rem .8rem;
    border-radius: 8px;
    margin-bottom: .8rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.flash-success { border-color: var(--success); color: var(--success); }
.flash-error { border-color: var(--danger); color: var(--danger); }
.flash-warning { border-color: var(--warning); color: var(--warning); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
}

/* 相邻卡片之间保留垂直间距，避免多张卡片直接贴合 */
.card + .card { margin-top: 1rem; }

/* 卡片内首个标题不额外撑开顶部留白 */
.card > :first-child { margin-top: 0; }


.page-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-head .spacer { margin-left: auto; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* 栅格内的卡片间距由 gap 控制，抵消相邻卡片的额外上边距 */
.grid > .card + .card { margin-top: 0; }


.repo-card { display: flex; flex-direction: column; gap: .5rem; }
.repo-card h3 { margin: 0; }

.badge {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .78rem;
    color: var(--text-muted);
}

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td {
    text-align: left;
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.data-table th { color: var(--text-muted); font-weight: 600; white-space: nowrap; }

.url-cell { word-break: break-all; font-family: var(--mono); font-size: .85rem; }

/* ===== 链接表格：横向滚动 + 列宽约束 + 右侧操作列固定 ===== */
.table-wrap {
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.links-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

table.links-table {
    border-collapse: separate;
    border-spacing: 0;
}

/* 用内阴影绘制分隔线，避免 sticky 单元格边框在横向滚动时丢失 */
table.links-table th,
table.links-table td {
    border-bottom: 0;
    box-shadow: inset 0 -1px 0 var(--border);
}

table.links-table tbody tr:last-child > * { box-shadow: none; }

/* 每列内容约束：块级容器承载最小 / 最大宽度，超出以省略号截断 */
.links-table .col-check { width: 44px; min-width: 44px; max-width: 44px; }
.links-table .col-check input { width: auto; margin: 0; }

.links-table .col-url a {
    display: block;
    min-width: 200px;
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.links-table .col-attr {
    min-width: 110px;
    max-width: 230px;
    white-space: nowrap;
}

.links-table .col-attr .cell-clip {
    display: block;
    min-width: 110px;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.links-table thead th.col-attr { white-space: normal; }

/* 右侧操作列：固定宽度 + 吸附在右侧 */
.links-table .col-actions {
    position: sticky;
    right: 0;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    background: var(--surface);
    box-shadow: inset 1px 0 0 var(--border), inset 0 -1px 0 var(--border);
    z-index: 1;
}

/* 吸附列左侧的柔和投影：随列一起移动，制造“浮在内容之上”的层次感 */
.links-table .col-actions::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -16px;
    width: 16px;
    pointer-events: none;
    background: linear-gradient(
        to right,
        transparent 0%,
        color-mix(in srgb, var(--pin-shadow) 30%, transparent) 40%,
        color-mix(in srgb, var(--pin-shadow) 70%, transparent) 75%,
        var(--pin-shadow) 100%
    );
}

table.links-table thead .col-actions { z-index: 2; }

table.links-table tbody tr:last-child .col-actions { box-shadow: inset 1px 0 0 var(--border); }

.links-table .col-actions .row-actions { flex-wrap: nowrap; }

.pagination { display: flex; gap: .4rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }

.page-size {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
    font-size: .85rem;
    white-space: nowrap;
}

.page-size select {
    width: auto;
    min-width: 0;
    margin-top: 0;
    padding: .25rem .45rem;
    font-size: .85rem;
    background: var(--surface-2);
}

.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 160px; }

.filters-panel { margin-bottom: 1rem; padding: 0; }

.filters-summary {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .7rem 1rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    border-radius: var(--radius);
}

.filters-summary::-webkit-details-marker { display: none; }

.filters-summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    color: var(--text-muted);
    transition: transform .15s ease;
}

.filters-panel[open] .filters-summary::before { transform: rotate(90deg); }

.filters-summary:hover { color: var(--primary); }
.filters-summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.filters-summary-title { font-weight: 600; }

.filters-summary-right {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    margin-left: auto;
}

.filters-summary-hint {
    font-size: .85rem;
    color: var(--text);
    padding: .05rem .5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
}

.filters-panel:not([open]) [data-filters-hint-collapse] { display: none; }
.filters-panel[open] [data-filters-hint-expand] { display: none; }

.filters-panel[open] .filters-summary {
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}

.filters-panel > .filters { padding: 1rem; }

.badge-active {
    color: var(--primary);
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: auto;
    padding: 1.25rem;
}

[hidden] { display: none !important; }

.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.table-cards { display: none; }

@media (max-width: 760px) {
    .app-header { gap: .5rem; }
    .app-nav { order: 3; width: 100%; }
    .table-wrap { display: none; }
    .table-cards { display: block; }

    .link-card {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: .75rem;
        margin-bottom: .6rem;
        background: var(--surface);
    }
    .link-card .url-cell { margin-bottom: .4rem; }
    .link-card dl { margin: 0 0 .5rem; display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; }
    .link-card dt { color: var(--text-muted); }
    .link-card dd { margin: 0; }
}

/* ===== WebUI 管理界面扩展 ===== */
code {
    font-family: var(--mono);
    font-size: .85em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .05rem .35rem;
}

.req { color: var(--danger); }

.repo-meta { display: flex; flex-wrap: wrap; gap: .35rem; }

.page-narrow { max-width: 840px; margin-inline: auto; }

.table-scroll { overflow-x: auto; }

.form-actions {
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}

.form-grid > label { display: block; font-size: .9rem; color: var(--text-muted); }
.form-grid label > input,
.form-grid label > select,
.form-grid label > textarea { margin-top: .35rem; }

.form-grid .form-grid-span { grid-column: 1 / -1; }

.check-line {
    display: flex !important;
    align-items: center;
    gap: .4rem;
    color: var(--text) !important;
}

.check-line input { width: auto; margin: 0; }

.filters .field label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .2rem; }
.filters .field-actions { display: flex; align-items: flex-end; gap: .5rem; }

.size-range { display: flex; gap: .3rem; }
.size-range input { min-width: 90px; }

.bulk-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin: 0;
}

.bulk-bar select,
.bulk-bar input {
    width: auto;
    min-width: 0;
    margin-top: 0;
    padding: .45rem .6rem;
    font-size: inherit;
    line-height: 1.5;
    background: var(--surface-2);
}

.bulk-bar select { min-width: 118px; }
.bulk-bar input { min-width: 150px; }

.bulk-count {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .45rem 0;
    color: var(--text-muted);
    font-size: .9rem;
    white-space: nowrap;
}

.bulk-count strong { color: var(--text); font-weight: 700; }

.bulk-attr { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}

.page-actions .bulk-bar {
    padding-left: .6rem;
    border-left: 1px solid color-mix(in srgb, var(--text-muted) 45%, var(--border));
}

.empty-state { color: var(--text-muted); text-align: center; padding: 2rem 1rem; }

.cards-toolbar { margin-bottom: .6rem; color: var(--text-muted); }
.cards-toolbar label { display: inline-flex; align-items: center; gap: .4rem; }

.link-card-head { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .4rem; }
.link-card-head input { width: auto; margin-top: .2rem; }
.link-card .url-cell { margin-bottom: 0; }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
}

.modal-head h2 { margin: 0; }

.modal-sm { max-width: 420px; }

.confirm-message { margin: 0 0 1.25rem; color: var(--text); }

.import-preview { margin-top: 1rem; }
.import-preview .table-wrap { margin-top: .5rem; }

.tag-ok { color: var(--success); }
.tag-error { color: var(--danger); font-size: .85rem; }

.token-box {
    border: 1px solid var(--success);
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.token-line {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}

.token-line code {
    flex: 1 1 260px;
    word-break: break-all;
    font-size: .9rem;
    background: var(--surface);
}

@media (max-width: 760px) {
    .form-grid { grid-template-columns: 1fr; }
    .filters .field { min-width: 100%; }
    .size-range { width: 100%; }

    .page-head .page-actions { width: 100%; }

    .page-actions .bulk-bar {
        flex: 1 0 100%;
        padding-left: 0;
        padding-top: .6rem;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .bulk-bar select,
    .bulk-bar input { flex: 1 1 auto; min-width: 0; }
    .bulk-bar .dlm-select { flex: 1 1 auto; min-width: 0; }
}

/* ===== 自定义下拉菜单 ===== */
.dlm-select {
    position: relative;
    display: block;
    width: 100%;
    margin-top: .35rem;
}

/* 原生 select 保留在文档中（表单提交 / 校验 / 读写值仍然可用），仅做视觉隐藏 */
.dlm-select > .dlm-select-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    font: inherit;
}

.dlm-select-trigger {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    margin: 0;
    padding: .5rem .6rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.dlm-select-trigger:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }

.dlm-select-trigger:focus-visible,
.dlm-select.is-open .dlm-select-trigger {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.dlm-select.is-invalid .dlm-select-trigger { border-color: var(--danger); }

.dlm-select-value {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dlm-select-value.is-placeholder { color: var(--text-muted); }

.dlm-select-arrow {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
    transition: transform .15s ease;
}

.dlm-select.is-open .dlm-select-arrow { transform: rotate(180deg); }

.dlm-select.is-disabled { opacity: .55; }
.dlm-select.is-disabled .dlm-select-trigger { cursor: not-allowed; }

.dlm-select-menu {
    position: fixed;
    z-index: 200;
    min-width: 120px;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .3rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
    animation: dlm-select-pop .12s ease-out;
}

html[data-theme="dark"] .dlm-select-menu {
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
}

@keyframes dlm-select-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dlm-select-option {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .55rem;
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
}

.dlm-select-option.is-active { background: var(--surface-2); }

.dlm-select-option.is-selected { color: var(--primary); font-weight: 600; }

.dlm-select-option.is-selected::after {
    content: "";
    flex: 0 0 auto;
    width: 5px;
    height: 9px;
    margin-left: auto;
    border: solid var(--primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.dlm-select-option.is-disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: .6;
}

.dlm-select-option-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dlm-select-group {
    padding: .35rem .55rem .2rem;
    font-size: .78rem;
    color: var(--text-muted);
}

.dlm-select-empty {
    padding: .5rem .55rem;
    color: var(--text-muted);
    font-size: .85rem;
}

.bulk-bar .dlm-select {
    display: inline-block;
    width: auto;
    min-width: 118px;
    margin-top: 0;
}

.bulk-bar .dlm-select-trigger {
    padding: .45rem .6rem;
    font-size: inherit;
    line-height: 1.5;
}

.page-size .dlm-select {
    display: inline-block;
    width: auto;
    margin-top: 0;
}

.page-size .dlm-select-trigger {
    padding: .25rem .45rem;
    font-size: .85rem;
}

/* ===== 文件选择控件 ===== */

/* 未启用 JS 时的原生外观兜底 */
input[type="file"] {
    width: 100%;
    margin-top: .35rem;
    padding: .3rem;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: .6rem;
    padding: .4rem .8rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--border);
}

/* 渐进增强后的自定义外观 */
.dlm-file {
    position: relative;
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .35rem;
    padding: .3rem;
    min-height: 42px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.dlm-file.is-focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.dlm-file.is-disabled {
    opacity: .55;
}

.dlm-file.is-disabled .dlm-file-trigger {
    cursor: not-allowed;
}

/* 提高优先级以覆盖上方的 input[type="file"] 兜底样式 */
.dlm-file > input.dlm-file-native[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    min-width: 0;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.dlm-file-trigger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .8rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: .9rem;
    line-height: 1.4;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.dlm-file-trigger:hover {
    background: var(--border);
}

.dlm-file-trigger:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.dlm-file-icon {
    flex: 0 0 auto;
    color: var(--text-muted);
}

.dlm-file-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
    color: var(--text-muted);
}

.dlm-file-name.is-set {
    color: var(--text);
}

.dlm-file-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-right: .2rem;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.dlm-file-clear:hover {
    background: var(--border);
    color: var(--text);
}
