:root {
    --brand: #d45746;
    --brand-dark: #b84233;
    --ink: #20242a;
    --muted: #6b7280;
    --line: #e5e7eb;
    --surface: #ffffff;
    --page: #f5f6f8;
    --sidebar: #252a30;
}

* { box-sizing: border-box; }
body { color: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; letter-spacing: 0; }
a { color: inherit; }

.admin-body { min-width: 320px; min-height: 100vh; background: var(--page); }
.admin-header { position: fixed; z-index: 1002; top: 0; right: 0; left: 0; height: 56px; display: flex; align-items: center; padding: 0 20px; color: #fff; background: #1d2126; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.admin-brand { font-size: 18px; font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.admin-user form { margin: 0; }
.admin-user .layui-btn-primary { color: #fff; border-color: #59616b; background: transparent; }
.mobile-nav-toggle { display: none; width: 34px; padding: 0; margin-right: 10px; color: #fff !important; border-color: #59616b !important; background: transparent !important; }

.admin-sidebar { position: fixed; z-index: 1001; top: 56px; bottom: 0; left: 0; width: 210px; background: var(--sidebar); }
.admin-sidebar .layui-nav { width: 100%; background: transparent; }
.admin-sidebar .layui-nav-item a { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 22px; color: #d7dce1; }
.admin-sidebar .layui-nav-item a:hover { color: #fff; background: #30363d; }
.admin-sidebar .layui-nav-item.layui-this a { color: #fff; background: var(--brand); }
.admin-sidebar .layui-nav-bar { display: none; }
.admin-sidebar .layui-icon { font-size: 18px; }

.admin-main { min-height: 100vh; padding: 82px 24px 32px 234px; }
.page-heading { min-height: 54px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading h1 { font-size: 24px; line-height: 1.3; font-weight: 600; }
.page-heading p { margin-top: 6px; color: var(--muted); }

.layui-btn { background-color: var(--brand); }
.layui-btn:hover { border-color: var(--brand-dark); background-color: var(--brand-dark); }
.layui-btn-primary { color: #4b5563; border-color: #d1d5db; background: #fff; }
.layui-btn-primary:hover { color: var(--brand); border-color: var(--brand); background: #fff; }
.layui-btn-danger { background: #dc2626; }
.layui-input:focus, .layui-textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 2px rgba(212, 87, 70, .1); }
.layui-form-select dl dd.layui-this { background-color: var(--brand); }

.content-panel { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.panel-heading { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 16px; font-weight: 600; }
.record-count { margin-left: 6px; color: var(--muted); font-size: 13px; font-weight: 400; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-item { position: relative; min-height: 104px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-left: 4px solid #6b7280; border-radius: 6px; background: #fff; transition: box-shadow .2s, transform .2s; }
.metric-item:hover { box-shadow: 0 8px 22px rgba(31, 41, 55, .09); transform: translateY(-2px); }
.metric-item span { display: block; color: var(--muted); }
.metric-item strong { display: block; margin-top: 10px; font-size: 30px; line-height: 1; }
.metric-pending { border-left-color: #d97706; }
.metric-processing { border-left-color: #2563eb; }
.metric-completed { border-left-color: #059669; }
.metric-closed { border-left-color: #6b7280; }

.table-scroll { width: 100%; overflow-x: auto; }
.admin-table { min-width: 940px; margin: 0; border: 0; }
.admin-table th { white-space: nowrap; color: #4b5563; background: #f9fafb; }
.admin-table td { max-width: 320px; }
.content-cell { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty-cell { height: 110px; text-align: center !important; color: var(--muted); }
.phone-link { color: #2563eb; }
.status-badge { display: inline-block; min-width: 58px; padding: 3px 8px; border-radius: 3px; text-align: center; font-size: 12px; }
.status-pending { color: #9a4f00; background: #fff1cf; }
.status-processing { color: #1d4ed8; background: #dbeafe; }
.status-completed { color: #047857; background: #d1fae5; }
.status-closed { color: #4b5563; background: #e5e7eb; }

.filter-panel { padding: 16px 18px; }
.filter-form { display: flex; align-items: flex-end; gap: 12px; }
.filter-field { width: 180px; }
.filter-keyword { width: min(360px, 40vw); }
.filter-field label { display: block; margin-bottom: 7px; color: #4b5563; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .layui-btn { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 18px; border-top: 1px solid var(--line); }
.page-item { min-width: 64px; padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 3px; text-align: center; background: #fff; }
.page-item:hover { color: var(--brand); border-color: var(--brand); }
.page-item.disabled { color: #a0a5ad; background: #f4f5f6; cursor: not-allowed; }
.page-summary { color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr); gap: 18px; }
.detail-list { padding: 4px 18px 18px; }
.detail-list > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); padding: 14px 0; border-bottom: 1px solid #eef0f2; }
.detail-list dt { color: var(--muted); }
.detail-list dd { min-width: 0; line-height: 1.7; overflow-wrap: anywhere; }
.detail-list a { color: #2563eb; }
.detail-content dd { white-space: pre-wrap; }
.follow-panel .layui-form { padding: 20px 18px 10px; }
.follow-panel .layui-form-label, .password-panel .layui-form-label { width: 82px; padding-left: 0; }
.follow-panel .layui-input-block, .password-panel .layui-input-block { margin-left: 92px; }
.notes-textarea { min-height: 190px; resize: vertical; }
.form-actions { padding-left: 92px; }
.danger-zone { display: flex; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }

.password-panel { width: min(620px, 100%); padding: 24px 22px; }
.field-help { margin-top: 6px; color: var(--muted); font-size: 12px; }
.notice-success, .notice-error { display: flex; align-items: center; gap: 8px; padding: 12px 14px; margin-bottom: 16px; border-radius: 4px; }
.notice-success { color: #047857; border: 1px solid #a7f3d0; background: #ecfdf5; }
.notice-error { color: #b91c1c; border: 1px solid #fecaca; background: #fef2f2; }

.login-body, .success-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef0f3; }
.login-panel, .success-panel { width: min(420px, 100%); padding: 30px; border: 1px solid #dfe3e8; border-radius: 6px; background: #fff; box-shadow: 0 16px 38px rgba(31, 41, 55, .12); }
.login-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.login-mark { width: 48px; height: 48px; display: grid; place-items: center; color: #fff; border-radius: 5px; background: var(--brand); }
.login-mark i { font-size: 26px; }
.login-heading h1 { font-size: 22px; font-weight: 600; }
.login-heading p { margin-top: 4px; color: var(--muted); }
.login-panel .layui-form-label { width: auto; float: none; padding: 0 0 7px; text-align: left; }
.login-panel .layui-input-block { margin: 0; }
.remember-row { margin-top: -2px; }
.login-submit { height: 42px; }
.login-error { margin-bottom: 18px; }
.success-panel { text-align: center; }
.success-icon { display: block; color: #059669; font-size: 64px; }
.success-panel h1 { margin-top: 14px; font-size: 24px; }
.success-panel p { margin: 12px 0 24px; color: var(--muted); }
.sidebar-mask { display: none; }

@media (max-width: 1080px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .mobile-nav-toggle { display: inline-block; }
    .admin-header { padding: 0 12px; }
    .admin-brand { font-size: 16px; }
    .admin-user > span { display: none; }
    .admin-sidebar { left: -210px; transition: left .2s; }
    .sidebar-open .admin-sidebar { left: 0; }
    .sidebar-mask { position: fixed; z-index: 1000; inset: 56px 0 0; background: rgba(0, 0, 0, .36); }
    .sidebar-open .sidebar-mask { display: block; }
    .admin-main { padding: 76px 12px 24px; }
    .page-heading { min-height: 0; align-items: center; }
    .page-heading h1 { font-size: 21px; }
    .page-heading p { display: none; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric-item { min-height: 92px; padding: 14px; }
    .metric-item strong { font-size: 25px; }
    .filter-form { align-items: stretch; flex-direction: column; }
    .filter-field, .filter-keyword { width: 100%; }
    .filter-actions .layui-btn { flex: 1; }
    .pagination { justify-content: center; }
    .detail-list > div { grid-template-columns: 76px minmax(0, 1fr); }
    .follow-panel .layui-form-label, .password-panel .layui-form-label { float: none; width: auto; padding: 0 0 7px; text-align: left; }
    .follow-panel .layui-input-block, .password-panel .layui-input-block { margin-left: 0; }
    .form-actions { padding-left: 0; }
    .password-panel { padding: 18px 16px; }
}
