/* 外链网盘: share pages, login and admin. Served under CSP style-src 'self'. */
:root {
    color-scheme: light;
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --border: #e3e8f0;
    --border-strong: #cdd5e1;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eaf1ff;
    --ring: #9dbcfb;
    --danger: #c62828;
    --danger-soft: #fdeeee;
    --success: #0f7a3d;
    --success-soft: #e8f6ed;
    --warn: #a15c00;
    --warn-soft: #fff4e0;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
button, a { touch-action: manipulation; }
button { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }

.nd-logo { width: 30px; height: 30px; flex: none; }
.nd-logo-bg { fill: var(--accent); }
.nd-logo-cloud { fill: #fff; }

/* Buttons and inputs */
.nd-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 0 16px;
    border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text-2);
    font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.nd-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); color: var(--text); }
.nd-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.nd-primary:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); color: #fff; }
.nd-danger { border-color: #efb4b4; color: var(--danger); }
.nd-danger:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.nd-small { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.nd-block { width: 100%; }
.nd-link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; cursor: pointer; }
.nd-link-btn:hover { text-decoration: underline; }
.nd-input {
    width: 100%; min-height: 38px; padding: 7px 11px;
    border: 1px solid var(--border-strong); border-radius: 9px;
    background: #fff; color: var(--text); font: inherit; font-size: 14px;
}
.nd-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nd-input[readonly] { background: var(--surface-2); color: var(--text-2); font-family: var(--mono); font-size: 13px; }
.nd-inline { display: inline-block; width: auto; min-height: 32px; padding: 3px 8px; margin-left: 6px; }
.nd-error { min-height: 0; margin: 0; color: var(--danger); font-size: 13.5px; }
.nd-error:empty { display: none; }
.nd-offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* Public pages: share, notice, login */
.nd-public { min-height: 100vh; padding: 28px 16px 48px; }
.nd-public-head {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 0 auto 22px; color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: .02em;
}
.nd-card {
    max-width: 560px; margin: 0 auto; padding: 32px 30px;
    border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow);
}
.nd-share { text-align: center; }
.nd-file-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 76px; height: 88px; margin: 0 auto 16px; padding-top: 16px;
    border-radius: 12px 30px 12px 12px;
    background: linear-gradient(160deg, #3b82f6, #1d4ed8); color: #fff;
    font-size: 15px; font-weight: 800; letter-spacing: .04em;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .25);
}
.nd-file-name { margin: 0 0 6px; font-size: 21px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.nd-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.nd-preview { display: block; max-width: 100%; max-height: 420px; margin: 0 auto 22px; border-radius: 10px; background: var(--surface-2); }
audio.nd-preview { width: 100%; }
.nd-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.nd-actions .nd-primary { min-width: 150px; min-height: 44px; font-size: 15px; }
.nd-toast { min-height: 22px; margin: 14px 0 0; color: var(--success); font-size: 13.5px; }
.nd-note { margin: 0 0 20px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 14px; text-align: left; white-space: pre-line; overflow-wrap: anywhere; }
.nd-site-notice { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.nd-pre { white-space: pre-line; overflow-wrap: anywhere; }
.nd-notice { text-align: center; }
.nd-notice-icon { width: 64px; height: 64px; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.nd-notice h1 { margin: 8px 0 6px; font-size: 20px; }
.nd-notice p { margin: 0; color: var(--muted); }
.nd-login { max-width: 400px; margin-top: 8vh; }
.nd-login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 17px; font-weight: 700; }
.nd-login h1 { margin: 0; font-size: 22px; }
.nd-sub { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.nd-login form { display: grid; gap: 14px; }
.nd-login label { display: grid; gap: 6px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.nd-login input {
    min-height: 42px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 10px; font: inherit;
}
.nd-login input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Admin */
.nd-top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: 58px; padding: 0 22px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.nd-top-brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 17px; font-weight: 700; }
.nd-top-brand #nd-site-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-tag { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.nd-top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.nd-user { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.nd-top-btn { min-height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 13px; cursor: pointer; }
.nd-top-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.nd-main { max-width: 1200px; margin: 0 auto; padding: 22px 22px 60px; }
.nd-panel { margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.nd-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nd-panel-head h2 { margin: 0; font-size: 15px; }
.nd-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.nd-toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nd-toolbar-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex: 1 1 560px; }
.nd-toolbar-right #nd-search { flex: 1 1 220px; max-width: 320px; }
.nd-select { width: auto; padding-right: 28px; cursor: pointer; }
.nd-sort-box { display: flex; gap: 6px; }
.nd-sort-dir { min-height: 38px; min-width: 76px; }
.nd-hint { color: var(--muted); font-size: 13px; }
.nd-stats { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.nd-message { margin: 0 0 14px; padding: 10px 14px; border: 1px solid #bfe3cc; border-radius: 10px; background: var(--success-soft); color: var(--success); font-size: 14px; overflow-wrap: anywhere; }
.nd-message:empty { display: none; }
.nd-message.nd-bad { border-color: #f4c4c4; background: var(--danger-soft); color: var(--danger); }

.nd-queue ul { margin: 0; padding: 0; list-style: none; }
.nd-queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.nd-queue li:first-child { border-top: 0; }
.nd-q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.nd-q-state { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.nd-q-state.nd-ok { color: var(--success); }
.nd-q-state.nd-bad { color: var(--danger); }
.nd-queue progress { grid-column: 1 / 2; width: 100%; height: 6px; accent-color: var(--accent); }
.nd-q-cancel { grid-row: 1 / 3; grid-column: 2; align-self: center; }

.nd-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 12px; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); }
.nd-bulk span { margin-right: 6px; color: var(--accent); font-size: 13.5px; font-weight: 600; }
.nd-table-wrap { overflow-x: auto; }
.nd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.nd-table th { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; white-space: nowrap; }
.nd-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.nd-table tbody tr:hover { background: var(--surface-2); }
.nd-table tbody tr:last-child td { border-bottom: 0; }
.nd-col-check { width: 34px; }
.nd-col-size, .nd-col-num { white-space: nowrap; }
.nd-col-num { text-align: right; }
td.nd-col-num { font-variant-numeric: tabular-nums; }
.nd-col-date, .nd-col-exp { white-space: nowrap; color: var(--text-2); }
.nd-col-ops { width: 1%; white-space: nowrap; }
.nd-ops { display: flex; gap: 6px; }
.nd-name { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.nd-name-text { padding: 0; border: 0; background: none; color: var(--text); font-size: 14px; font-weight: 500; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.nd-name-text:hover { color: var(--accent); text-decoration: underline; }
.nd-sort-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.nd-sort-btn:hover { color: var(--text); }
.nd-sort-btn::after { content: "↕"; opacity: .35; font-size: 11px; }
th.nd-sorted { color: var(--accent); }
th.nd-sorted .nd-sort-btn::after { content: "↓"; opacity: 1; }
th.nd-sorted.nd-asc .nd-sort-btn::after { content: "↑"; }
.nd-col-num .nd-sort-btn { flex-direction: row-reverse; }
.nd-disabled { opacity: .45; pointer-events: none; }
.nd-chip { flex: none; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.nd-chip-off { background: #eef1f5; color: var(--muted); }
.nd-chip-exp { background: var(--warn-soft); color: var(--warn); }
.nd-chip-bad { background: var(--danger-soft); color: var(--danger); }
.nd-chip-note { background: var(--accent-soft); color: var(--accent); cursor: help; }
.nd-empty { margin: 18px 0 6px; color: var(--muted); text-align: center; }
.nd-drop {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
    background: rgba(37, 99, 235, .12); backdrop-filter: blur(2px);
}
.nd-drop div { padding: 28px 44px; border: 2px dashed var(--accent); border-radius: 18px; background: #fff; color: var(--accent); font-size: 18px; font-weight: 600; }

.nd-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.nd-dialog-wide { width: min(680px, calc(100vw - 32px)); }
.nd-group { display: grid; gap: 12px; margin: 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 12px; }
.nd-group legend { padding: 0 6px; color: var(--text); font-size: 13.5px; font-weight: 700; }
.nd-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.nd-textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
.nd-mono { font-family: var(--mono); }
.nd-wrap { flex-wrap: wrap; }
.nd-presets { display: inline-flex; gap: 10px; margin-left: 4px; }
.nd-center { align-items: center; }
.nd-strong { color: var(--text); font-weight: 600; }
.nd-dialog::backdrop { background: rgba(15, 23, 42, .35); }
.nd-dialog form { display: grid; gap: 14px; padding: 22px 22px 18px; }
.nd-dialog h2 { margin: 0; font-size: 18px; }
.nd-dialog label, .nd-field { display: grid; gap: 6px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.nd-field > span { color: var(--text-2); }
.nd-dialog .nd-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.nd-copy-row { display: flex; gap: 8px; }
.nd-help { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.nd-meta-line { margin: 0; color: var(--muted); font-size: 13px; }
.nd-meta-line:empty { display: none; }
.nd-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.nd-grow { flex: 1; }

@media (max-width: 1100px) {
    .nd-col-exp { display: none; }
}
@media (max-width: 760px) {
    .nd-top { padding: 0 14px; }
    .nd-user { display: none; }
    .nd-main { padding: 14px 12px 48px; }
    .nd-hint { display: none; }
    .nd-toolbar-right { flex-basis: 100%; justify-content: flex-start; }
    .nd-toolbar-right #nd-search { flex-basis: 100%; max-width: none; }
    .nd-toolbar-right .nd-select { flex: 1 1 0; min-width: 0; }
    .nd-sort-box { flex: 1 1 0; min-width: 0; }
    .nd-card { padding: 26px 18px; }
}
@media (max-width: 900px) {
    /* the file table becomes one compact card per file: name, size, buttons */
    .nd-table thead { display: none; }
    .nd-table, .nd-table tbody { display: block; }
    .nd-table tr { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 2px 8px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
    .nd-table tbody tr:last-child { border-bottom: 0; }
    .nd-table td { padding: 0; border: 0; }
    .nd-table td.nd-col-check { grid-row: 1 / span 3; padding-top: 2px; }
    .nd-table td.nd-col-size { grid-column: 2; color: var(--muted); font-size: 12.5px; }
    .nd-table td.nd-col-date, .nd-table td.nd-col-exp, .nd-table td.nd-col-num { display: none; }
    .nd-table td.nd-col-ops { grid-column: 2; width: auto; padding-top: 6px; }
    .nd-name { min-width: 0; flex-wrap: wrap; }
    .nd-ops { flex-wrap: wrap; }
}
