:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #20242c;
    --muted: #6b7280;
    --line: #dfe3ea;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #12805c;
    --danger: #b42318;
    --warning: #9a6700;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    line-height: 1.6;
}

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

.wrap {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    background: #111827;
    color: #fff;
    border-bottom: 1px solid #0b1220;
}

.topbar-inner {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a {
    color: #dbeafe;
    font-size: 14px;
}

.page {
    padding: 28px 0 44px;
}

.hero {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 22px;
}

.hero > div:first-child,
.query-box,
.panel,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.hero > div:first-child {
    padding: 34px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-weight: 700;
}

h1, h2, h3, p {
    margin-top: 0;
}

.hero h1 {
    font-size: 34px;
    margin-bottom: 12px;
}

.hero p {
    color: var(--muted);
    max-width: 720px;
}

.query-box {
    padding: 24px;
}

.query-panel {
    margin-bottom: 18px;
}

.query-box label,
.form-grid span,
.login-form span,
.side-form span {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.query-row {
    display: flex;
    gap: 10px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

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

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    padding: 10px 18px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

button:hover, .btn:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn.secondary {
    background: #eef2f7;
    color: #111827;
}

.btn.danger {
    background: #dc2626;
    color: #fff;
}

.btn.danger:hover {
    background: #b91c1c;
}

.btn.small {
    padding: 6px 12px;
    font-size: 13px;
}

.notice {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
}

.notice.success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: var(--success);
}

.notice.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--danger);
}

.success-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    z-index: 1100;
    min-width: 168px;
    transform: translateX(-50%);
    padding: 12px 22px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.22);
    opacity: 1;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.success-toast.is-hiding {
    opacity: 0;
    transform: translate(-50%, -8px);
}

.panel {
    padding: 24px;
    margin-bottom: 18px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: baseline;
    margin-bottom: 18px;
}

.panel-title h2 {
    margin: 0;
}

.form-title {
    display: block;
    text-align: center;
}

.form-title p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.panel-title span,
.muted,
em {
    color: var(--muted);
    font-size: 13px;
}

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

.full {
    grid-column: 1 / -1;
}

.action-row {
    display: flex;
    justify-content: flex-end;
}

.result-card {
    margin-top: 14px;
    display: grid;
    gap: 5px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.result-card b {
    color: var(--primary);
}

.login-panel {
    max-width: 420px;
    margin: 36px auto;
    padding: 28px;
}

.login-form,
.side-form {
    display: grid;
    gap: 16px;
}

.admin-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 18px;
}

.admin-head h1 {
    margin-bottom: 4px;
}

.admin-head p {
    color: var(--muted);
    margin: 0;
}

.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 14px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.4fr 1fr 1fr auto auto;
    gap: 10px;
}

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

.table-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1080px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

.data-table th {
    background: #f8fafc;
    color: #374151;
    font-weight: 700;
}

.check-col {
    width: 42px;
    text-align: center !important;
}

.index-col {
    width: 58px;
}

.check-col input {
    width: 16px;
    height: 16px;
    padding: 0;
}

.title-cell {
    max-width: 280px;
}

.empty {
    text-align: center !important;
    color: var(--muted);
    padding: 28px !important;
}

.status {
    display: inline-block;
    min-width: 68px;
    text-align: center;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    background: #f3f4f6;
    color: #374151;
}

.status.pending {
    background: #fff7ed;
    color: var(--warning);
}

.status.processing {
    background: #eff6ff;
    color: var(--primary);
}

.status.resolved {
    background: #ecfdf5;
    color: var(--success);
}

.status.unconfirmed {
    background: #fef2f2;
    color: var(--danger);
}

.detail-top {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
}

.detail-top h1 {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
}

.info-list {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px 14px;
    margin: 0 0 20px;
}

.info-list dt {
    color: var(--muted);
}

.info-list dd {
    margin: 0;
}

.text-block {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    font-family: inherit;
}

.file-list {
    display: grid;
    gap: 8px;
}

.file-list a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #f8fafc;
}

.image-preview,
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 16px;
}

.upload-field > span {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
}

.upload-dropzone {
    min-height: 146px;
    border: 1px dashed #8aa4d6;
    border-radius: 14px;
    background: #fbfdff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: #16213a;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
    border-color: var(--primary);
    background: #f3f7ff;
}

.upload-dropzone input {
    display: none;
}

.upload-icon {
    display: block;
    font-size: 38px;
    line-height: 1;
}

.upload-dropzone strong {
    font-size: 14px;
    font-weight: 700;
}

.upload-dropzone em {
    font-style: normal;
    color: var(--muted);
    font-size: 12px;
}

.image-preview-item {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid var(--line);
}

.image-gallery .image-thumb {
    display: grid;
    gap: 8px;
    width: 150px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.image-preview img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    background: #e5e7eb;
}

.image-gallery img {
    display: block;
    width: 132px;
    height: 132px;
    object-fit: cover;
    border-radius: 6px;
    background: #e5e7eb;
}

.image-gallery span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
}

.image-viewer[hidden] {
    display: none;
}

.viewer-open {
    overflow: hidden;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.74);
}

.image-viewer-panel {
    position: relative;
    z-index: 1;
    max-width: min(1100px, 94vw);
    max-height: 92vh;
    display: grid;
    gap: 10px;
    justify-items: center;
}

.image-viewer-panel img {
    max-width: 100%;
    max-height: calc(92vh - 52px);
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.image-viewer-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 26px;
    line-height: 1;
}

.image-viewer-name {
    max-width: 100%;
    color: #fff;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 20px;
    line-height: 1;
}

.image-remove:hover {
    background: #ef4444;
}

.note-list {
    display: grid;
    gap: 12px;
}

.note-list article {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: #f8fafc;
}

.note-list time {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.note-list p {
    margin: 8px 0 0;
}

.footer {
    padding: 20px 0;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--line);
    background: #fff;
}

@media (max-width: 900px) {
    .hero,
    .detail-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .query-row {
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .wrap {
        width: min(100% - 20px, 1180px);
    }

    .topbar-inner,
    .panel-title,
    .detail-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero > div:first-child,
    .query-box,
    .panel,
    .login-panel {
        padding: 18px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }
}
