/* ==========================================================================
   数据管理后台样式
   浅蓝主题，与数据大屏呼应，但作为工具页更克制：白卡片 + 清晰层级
   ========================================================================== */

:root {
    --bg-1: #eaf3ff;
    --bg-2: #f7fbff;
    --card: #ffffff;
    --line: #dbe8f8;
    --ink: #16324f;
    --ink-2: #5c7a9c;
    --ink-3: #8ba4c0;

    --blue: #2f7fd8;
    --blue-dark: #1c5fae;
    --blue-soft: #eaf3ff;

    --red: #d94a4a;
    --red-dark: #b83636;
    --red-soft: #fdeeee;

    --green: #1f9d63;
    --green-soft: #e9f8f1;

    --radius: 12px;
    --shadow: 0 4px 16px rgba(31, 93, 163, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 100%);
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, opacity .15s;
}

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

.btn--primary {
    background: linear-gradient(135deg, #4a95e6, var(--blue-dark));
    color: #fff;
}
.btn--primary:hover:not(:disabled) { background: linear-gradient(135deg, #3d8ade, #17509b); }

.btn--ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--blue-dark);
}
.btn--ghost:hover { border-color: #b6d2f2; background: var(--blue-soft); }

.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { background: var(--red-dark); }

.btn--sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; height: 42px; font-size: 15px; }

/* ==========================================================================
   登录页
   ========================================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    padding: 36px 32px 28px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-card__title { font-size: 20px; letter-spacing: .5px; }

.login-card__desc {
    margin: 8px 0 24px;
    font-size: 13px;
    color: var(--ink-2);
}

.login-card__input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    letter-spacing: 2px;
    background: #fbfdff;
}
.login-card__input:focus {
    outline: none;
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(47, 127, 216, .12);
}

.login-card__error {
    margin: -6px 0 12px;
    font-size: 13px;
    color: var(--red);
    text-align: left;
}

.login-card__back {
    display: inline-block;
    margin-top: 18px;
    font-size: 13px;
    color: var(--ink-3);
    text-decoration: none;
}
.login-card__back:hover { color: var(--blue); }

/* ==========================================================================
   管理界面
   ========================================================================== */
.page { max-width: 1240px; margin: 0 auto; padding: 0 24px 40px; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.topbar__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .5px;
}

.topbar__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}

.topbar__actions { display: flex; gap: 8px; }

.content { display: flex; flex-direction: column; gap: 18px; }

/* ---------- 卡片 ---------- */
.card {
    padding: 18px 22px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card__title { font-size: 15px; letter-spacing: .5px; }
.card__note { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 文件信息 ---------- */
.info__loading { margin: 0; color: var(--ink-3); }

.info__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.info__item {
    padding: 12px 14px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.info__label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.info__value {
    font-size: 16px;
    font-weight: 600;
    color: var(--blue-dark);
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

.info__value--muted { color: var(--ink-3); font-weight: 400; font-size: 14px; }

.info__badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}
.info__badge--on { background: var(--green-soft); color: var(--green); }
.info__badge--off { background: var(--red-soft); color: var(--red); }

/* ---------- 操作区 ---------- */
.ops { display: flex; flex-direction: column; gap: 22px; }

.ops__item--danger {
    padding-top: 20px;
    border-top: 1px dashed var(--line);
}

.ops__label {
    margin-bottom: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.ops__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ops__file {
    flex: 1;
    min-width: 260px;
    padding: 8px 10px;
    border: 1px dashed #bcd6f2;
    border-radius: 8px;
    background: #fbfdff;
    font-size: 13px;
    font-family: inherit;
    color: var(--ink-2);
}

.ops__hint {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--ink-3);
}

/* ---------- 预览表格 ---------- */
.preview-wrap { overflow-x: auto; }

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table th,
.preview-table td {
    padding: 9px 12px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.preview-table th {
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-weight: 600;
    white-space: nowrap;
}

.preview-table td {
    max-width: 320px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-table tbody tr:nth-child(even) td { background: #fafcff; }

.preview-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--ink-3);
    font-size: 13.5px;
}

/* ---------- 提示条 ---------- */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 640px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(31, 93, 163, .16);
    z-index: 100;
    animation: toastIn .2s ease;
}
.toast[hidden] { display: none; }

.toast--ok { background: var(--green-soft); color: var(--green); border: 1px solid #b8e6d2; }
.toast--err { background: var(--red-soft); color: var(--red); border: 1px solid #f4c9c9; }

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 确认弹窗 ---------- */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal[hidden] { display: none; }

.modal__mask {
    position: absolute;
    inset: 0;
    background: rgba(20, 51, 84, .38);
}

.modal__box {
    position: relative;
    width: calc(100% - 48px);
    max-width: 420px;
    padding: 26px 26px 20px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(20, 51, 84, .22);
    animation: modalIn .18s ease;
}

.modal__title { font-size: 16px; margin-bottom: 12px; }

.modal__text {
    margin: 0 0 22px;
    font-size: 13.5px;
    line-height: 1.8;
    color: var(--ink-2);
}
.modal__text strong { color: var(--red); word-break: break-all; }

.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(.96); }
    to { opacity: 1; transform: scale(1); }
}
