/* =========================================================================
   Reset & base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #222;
    background: #f6f7f9;
    line-height: 1.5;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0 0 0.5em; }

/* =========================================================================
   Public siquery (scan result) page — 对标济南人社 jnhrss.jinan.gov.cn 极简风
   ========================================================================= */
body { background: #fff; }
.siquery {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.5rem;
}
.siquery .page {
    margin: 0 0 0.5rem 0;
}
.siquery .page:last-child {
    margin-bottom: 0;
}
.siquery .page img {
    width: 100%;
    height: auto;
    display: block;
}
.siquery .empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

/* =========================================================================
   404 / not found
   ========================================================================= */
.notfound {
    max-width: 500px;
    margin: 4rem auto;
    padding: 2rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
}
.notfound h1 { color: #dc2626; }
.notfound .msg { font-size: 1rem; color: #334155; margin: 1rem 0; }
.notfound .hint { font-size: 0.85rem; color: #94a3b8; }

/* =========================================================================
   Admin nav
   ========================================================================= */
body.admin { background: #f6f7f9; }
.admin-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.admin-nav a { color: #e2e8f0; }
.admin-nav a:hover { color: #fff; text-decoration: none; }
.admin-nav .brand { font-weight: 600; font-size: 1rem; }
.admin-nav .spacer { flex: 1; }
.admin-nav .btn-nav-primary {
    background: #2563eb;
    padding: 0.35em 0.9em;
    border-radius: 4px;
}
.admin-nav .btn-nav-primary:hover { background: #1d4ed8; }
.admin-nav .logout { font-size: 0.85rem; opacity: 0.8; }

.admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}
.page-title { color: #0f172a; margin-bottom: 1.25rem; }

/* =========================================================================
   Flash messages
   ========================================================================= */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* =========================================================================
   Login page
   ========================================================================= */
.login-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    margin: 0;
}
.login-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    min-width: 320px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-form h1 {
    text-align: center;
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #0f172a;
}
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #475569;
}
.login-form input {
    padding: 0.6em 0.8em;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.95rem;
}
.login-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.login-form button {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 0.7em;
    border-radius: 4px;
    font-weight: 600;
}
.login-form button:hover { background: #1d4ed8; }

/* =========================================================================
   List / toolbar
   ========================================================================= */
.list-toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.list-toolbar .search { display: flex; gap: 0.5rem; flex: 1; min-width: 280px; }
.list-toolbar .search input {
    flex: 1;
    padding: 0.5em 0.8em;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}
.list-toolbar .search button {
    padding: 0.5em 1em;
    background: #0f172a;
    color: #fff;
    border: 0;
    border-radius: 4px;
}
.list-toolbar .clear { color: #64748b; font-size: 0.85rem; align-self: center; }
.list-toolbar .stats { font-size: 0.85rem; color: #64748b; }

/* =========================================================================
   Records table
   ========================================================================= */
.records-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}
.records-table th, .records-table td {
    padding: 0.7em 0.9em;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    vertical-align: top;
}
.records-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.records-table tr:last-child td { border-bottom: 0; }
.records-table tr:hover td { background: #f8fafc; }
.records-table .yzm-link code {
    background: #f1f5f9;
    padding: 0.2em 0.5em;
    border-radius: 3px;
    color: #0f172a;
    font-size: 0.85rem;
}
.records-table .company { color: #0f172a; }
.records-table .note { font-size: 0.8rem; color: #94a3b8; margin-top: 0.2em; }
.records-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.records-table .time { font-variant-numeric: tabular-nums; color: #64748b; font-size: 0.85rem; }
.records-table .empty { text-align: center; color: #94a3b8; padding: 3em; }

/* 列表行内操作按钮（编辑 / 删除） */
.row-actions { white-space: nowrap; }
.row-actions .inline-btn { margin-right: 0.3em; }
.inline-btn {
    padding: 0.3em 0.8em !important;
    font-size: 0.85rem !important;
    display: inline-block;
    text-decoration: none;
}
.inline-btn:hover { text-decoration: none; }

/* =========================================================================
   Pagination
   ========================================================================= */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
}
.pagination .pg-btn {
    padding: 0.4em 0.9em;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #334155;
    text-decoration: none;
}
.pagination .pg-btn:hover {
    background: #f1f5f9;
    text-decoration: none;
}
.pagination .pg-btn.disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: not-allowed;
}
.pagination .pg-info {
    padding: 0 0.5rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Upload form
   ========================================================================= */
.upload-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.upload-form label { display: flex; flex-direction: column; gap: 0.35rem; }
.upload-form .field-label { font-weight: 500; color: #334155; font-size: 0.9rem; }
.upload-form input[type="text"], .upload-form input:not([type]), .upload-form input[name] {
    padding: 0.55em 0.8em;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}
.upload-form input[type="file"] {
    padding: 0.5em;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    background: #f8fafc;
}
.upload-form .hint { font-size: 0.8rem; color: #94a3b8; }
.upload-form .required { color: #dc2626; margin-left: 0.2em; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-block;
    padding: 0.55em 1.25em;
    border: 0;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover   { background: #1d4ed8; text-decoration: none; }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-secondary:hover { background: #cbd5e1; text-decoration: none; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover    { background: #b91c1c; text-decoration: none; }

/* =========================================================================
   Detail page
   ========================================================================= */
.detail-card, .qr-section, .images-section, .danger-zone {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.detail-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.5rem;
    margin: 0;
}
.detail-dl dt { color: #64748b; font-size: 0.85rem; }
.detail-dl dd { margin: 0; color: #0f172a; }
.detail-dl code.big { font-size: 1rem; background: #f1f5f9; padding: 0.2em 0.5em; border-radius: 3px; }

.qr-section { text-align: center; }
.qr-image { max-width: 240px; height: auto; image-rendering: pixelated; }

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}
.image-grid figure { margin: 0; }
.image-grid img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}
.image-grid figcaption {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    text-align: center;
    word-break: break-all;
}

.danger-zone { border-color: #fca5a5; background: #fef2f2; }
.danger-zone h2 { color: #991b1b; margin-top: 0; }

/* =========================================================================
   Mobile
   ========================================================================= */
@media (max-width: 640px) {
    .admin-nav { flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 1rem; }
    .admin-nav .brand { width: 100%; }
    .admin-nav .spacer { display: none; }
    .records-table { font-size: 0.8rem; }
    .records-table th, .records-table td { padding: 0.5em; }
    .records-table .time { font-size: 0.75rem; }
    .detail-dl { grid-template-columns: 1fr; gap: 0.25rem; }
    .detail-dl dt { margin-top: 0.5rem; }
}
