/* ==========================================================================
   车辆抵押文书管理系统 — 全局样式（现代 SaaS / 国际站风格 · 响应式）
   断点：≤1024 平板  |  ≤768 大屏手机  |  ≤520 小屏手机
   ========================================================================== */

:root {
    /* 品牌色板 */
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;

    /* 文本 */
    --text-900: #0f172a;
    --text-700: #334155;
    --text-500: #64748b;
    --text-400: #94a3b8;

    /* 边框 / 背景 */
    --line: #e2e8f0;
    --line-soft: #eef1f5;
    --bg: #f4f6fb;
    --surface: #ffffff;

    /* 状态 */
    --green-600: #16a34a;
    --green-50:  #f0fdf4;
    --green-line:#bbf7d0;
    --red-600:  #dc2626;
    --red-50:   #fef2f2;
    --red-line: #fecaca;
    --amber-600:#ca8a04;
    --amber-50: #fefce8;

    /* 圆角 / 阴影 */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 9px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 28px rgba(15, 23, 42, .06);
    --shadow-hover: 0 4px 10px rgba(79, 70, 229, .10), 0 14px 34px rgba(15, 23, 42, .10);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
            "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 500px at 80% -10%, #eef2ff 0%, rgba(238,242,255,0) 55%),
        var(--bg);
    color: var(--text-900);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video, input, select, textarea, button { max-width: 100%; }

/* ==========================================================================
   顶部导航（毛玻璃吸顶）
   ========================================================================== */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line-soft);
    padding: 0 28px;
    min-height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
}
.topbar .brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 16.5px; font-weight: 700; letter-spacing: .2px;
    color: var(--text-900); white-space: nowrap;
}
.topbar .brand::before {
    content: ""; width: 28px; height: 28px; border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-600), #7c3aed);
    box-shadow: 0 4px 10px rgba(79, 70, 229, .35);
    flex: none;
}
.topbar .nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar .nav a {
    color: var(--text-700); font-size: 14.5px; font-weight: 500;
    padding: 8px 13px; border-radius: 9px;
}
.topbar .nav a:hover { color: var(--brand-700); background: var(--brand-50); text-decoration: none; }

/* ==========================================================================
   页面容器与卡片
   ========================================================================== */
.wrap { max-width: 1120px; margin: 28px auto; padding: 0 20px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-card);
    margin-bottom: 22px;
}

h2.title { font-size: 22px; font-weight: 700; letter-spacing: -.2px; color: var(--text-900); }
h3.sub {
    font-size: 15.5px; font-weight: 700; color: var(--text-900);
    margin: 24px 0 16px; padding-left: 12px;
    border-left: 3px solid var(--brand-600); line-height: 1.3;
}

/* 顶部标题 + 操作按钮的横向行 */
.header-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.header-row .title { margin: 0; }

/* 工具栏 / 搜索行 */
.toolbar-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar-row input[type="text"] { flex: 1 1 260px; max-width: 420px; }
.toolbar-row input[type="file"] { flex: 1 1 240px; font-size: 14px; }
.file-label { font-weight: 600; font-size: 14px; }
.hint { color: var(--text-500); font-size: 13px; }

/* ==========================================================================
   表单
   ========================================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; }
.field label {
    display: block; margin-bottom: 7px; font-weight: 600; font-size: 13.5px; color: var(--text-700);
}
.field input, .field select, .field textarea {
    width: 100%; min-width: 0; display: block; padding: 11px 13px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit; color: var(--text-900);
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-400); }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field input[type="date"] { min-height: 44px; }

/* 操作按钮行 */
.actions { margin-top: 26px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.actions span { color: var(--text-500); font-size: 13.5px; }

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 22px; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: var(--brand-600); color: #fff; font-size: 15px; font-weight: 600;
    cursor: pointer; line-height: 1.2; white-space: nowrap;
    transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(79, 70, 229, .25);
}
.btn:hover { background: var(--brand-700); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.gray { background: #f1f5f9; color: var(--text-700); box-shadow: none; border-color: var(--line); }
.btn.gray:hover { background: #e2e8f0; }
.btn.danger { background: var(--red-600); box-shadow: 0 2px 8px rgba(220, 38, 38, .25); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 7px 14px; font-size: 13.5px; border-radius: 8px; box-shadow: none; }
.btn.block { width: 100%; }

/* ==========================================================================
   提示条
   ========================================================================== */
.msg { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; }
.msg.err { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-line); }
.msg.ok  { background: var(--green-50); color: var(--green-600); border: 1px solid var(--green-line); }

/* ==========================================================================
   数据表格（手机横向滚动）
   ========================================================================== */
.table-scroll { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
table.grid { width: 100%; border-collapse: collapse; min-width: 760px; }
table.grid th, table.grid td {
    border-bottom: 1px solid var(--line-soft); padding: 13px 14px; text-align: left; font-size: 14px;
    white-space: nowrap;
}
table.grid th {
    background: #f8fafc; font-weight: 600; color: var(--text-500);
    font-size: 12.5px; letter-spacing: .3px; text-transform: uppercase;
}
table.grid tbody tr, table.grid tr { transition: background .12s; }
table.grid tr:hover td { background: #f8fafc; }

/* ==========================================================================
   登录 / 注册卡片
   ========================================================================== */
.login-box { width: 100%; max-width: 420px; margin: 64px auto; }
.login-box .card { padding: 34px 30px; }
.login-box .field { margin-bottom: 18px; }
.login-box .field input { min-height: 46px; }
.center { text-align: center; }
.center-hint { margin-top: 16px; text-align: center; color: var(--text-500); font-size: 14px; }

/* ==========================================================================
   文书入口卡片
   ========================================================================== */
.doc-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.doc-card {
    border: 1px solid var(--line-soft); border-radius: var(--radius-md);
    padding: 22px; background: var(--surface); color: var(--text-900);
    transition: border-color .15s, box-shadow .15s, transform .15s;
    position: relative; overflow: hidden;
}
.doc-card:hover {
    border-color: var(--brand-100); text-decoration: none;
    box-shadow: var(--shadow-hover); transform: translateY(-2px);
}
.doc-card .name { font-size: 15.5px; font-weight: 700; margin-bottom: 10px; }
.doc-card .status { font-size: 13px; color: var(--text-500); }
.doc-card .status.done { color: var(--green-600); font-weight: 500; }

/* ==========================================================================
   文件网格（图片 / 视频）
   ========================================================================== */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.file-item {
    border: 1px solid var(--line-soft); border-radius: var(--radius-md);
    overflow: hidden; background: var(--surface);
    transition: box-shadow .15s, transform .15s;
}
.file-item:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.file-item .thumb {
    height: 150px; background: #f1f5f9;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.file-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-item .thumb video { width: 100%; height: 100%; object-fit: cover; }
.file-item .meta { padding: 12px 13px; font-size: 13px; }
.file-item .meta .fname { word-break: break-all; margin-bottom: 8px; color: var(--text-700); }
.file-item .meta .ops { margin-top: 8px; display: flex; gap: 14px; }
.file-item .meta .ops a { color: var(--brand-600); }
.file-item .meta .ops a.del, .file-item .meta .ops a[style*="red"] { color: var(--red-600); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.img { background: var(--brand-50); color: var(--brand-600); }
.badge.vid { background: var(--amber-50); color: var(--amber-600); }

/* 空状态 */
.empty { color: var(--text-400); padding: 24px 0; text-align: center; }

/* ==========================================================================
   响应式断点
   ========================================================================== */
@media (max-width: 1024px) {
    .wrap { max-width: 960px; }
    .doc-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    body { font-size: 14.5px; }
    .wrap { margin: 18px auto; padding: 0 14px; max-width: 100%; }
    .card { padding: 20px 18px; border-radius: var(--radius-md); max-width: 100%; }

    /* 导航纵向堆叠 */
    .topbar { flex-direction: column; align-items: stretch; padding: 12px 16px; gap: 10px; min-height: auto; }
    .topbar .nav { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
    .topbar .nav a { white-space: nowrap; padding: 8px 10px; }

    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .header-row { flex-direction: column; align-items: stretch; }
    .header-row > .btn { width: 100%; }
    .toolbar-row { flex-direction: column; align-items: stretch; }
    .toolbar-row input[type="text"],
    .toolbar-row input[type="file"] { flex: 0 1 auto; width: 100%; max-width: none; height: auto; }
    .table-scroll { width: 100%; }
    .actions { flex-direction: column; align-items: stretch; }
    .actions .btn { width: 100%; }

    h2.title { font-size: 19px; }
    .login-box { margin: 32px auto; }
    .login-box .card { padding: 26px 20px; }
    .file-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .file-item .thumb { height: 120px; }
}

@media (max-width: 520px) {
    .doc-cards { grid-template-columns: 1fr; }
    .file-grid { grid-template-columns: 1fr; }
    .topbar .brand { font-size: 15px; }
    .field input, .field select, .field textarea { font-size: 16px; } /* 防 iOS 缩放 */
}

/* 打印：隐藏后台操作元素 */
@media print {
    .topbar, .no-print { display: none !important; }
    body { background: #fff; }
}
