.boot-error {
    margin: 24px;
    padding: 18px 20px;
    border: 1px solid #f3b2a8;
    border-radius: 16px;
    color: #8f2f22;
    background: #fff3f0;
    font-family: Consolas, "Microsoft YaHei", sans-serif;
    white-space: pre-wrap;
}

:root {
    --ink: #17211b;
    --muted: #6d7a70;
    --paper: #f5f1e8;
    --card: rgba(255, 255, 255, .86);
    --line: #e4dccd;
    --green: #246b4b;
    --amber: #d58b2a;
    --blue: #2e667d;
    --red: #b54d3c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    font-family: "Alibaba PuHuiTi", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(213, 139, 42, .18), transparent 32rem),
        radial-gradient(circle at 72% 18%, rgba(36, 107, 75, .16), transparent 26rem),
        linear-gradient(135deg, #fbf7ed 0%, #eef3eb 100%);
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
}

.login-card {
    width: min(460px, 100%);
    padding: 38px;
    border: 1px solid rgba(36,107,75,.16);
    border-radius: 34px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.94), rgba(248,239,214,.84)),
        radial-gradient(circle at 85% 16%, rgba(36,107,75,.18), transparent 16rem);
    box-shadow: 0 28px 90px rgba(39, 58, 45, .18);
}

.login-emblem {
    position: relative;
    display: grid;
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 22px;
    color: #173c2a;
    font-size: 30px;
    background: linear-gradient(135deg, #f4d38a, #8fd1a8);
}

.login-emblem span,
.brand-mark span {
    position: absolute;
    color: #173c2a;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
}

.login-card h1 {
    margin: 0;
    font-family: "Source Han Serif SC", "Noto Serif SC", serif;
    font-size: 30px;
}

.login-subtitle {
    margin: 10px 0 28px;
    color: var(--muted);
}

.login-form .el-form-item {
    margin-bottom: 18px;
}

.login-button {
    width: 100%;
}

.admin-shell { min-height: 100vh; }

.sidebar {
    position: relative;
    overflow: hidden;
    color: #f7f3e8;
    background:
        linear-gradient(160deg, rgba(22, 38, 31, .96), rgba(19, 54, 42, .98)),
        repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 1px, transparent 1px 12px);
    box-shadow: 18px 0 50px rgba(32, 45, 36, .18);
}

.sidebar::after {
    content: "";
    position: absolute;
    right: -70px;
    bottom: -70px;
    width: 190px;
    height: 190px;
    border: 1px solid rgba(235, 202, 132, .28);
    border-radius: 50%;
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 26px 24px 22px;
}

.brand-mark {
    position: relative;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 16px;
    color: #17211b;
    font-size: 24px;
    background: linear-gradient(135deg, #f4d38a, #8fd1a8);
    box-shadow: 0 16px 34px rgba(0,0,0,.22);
}

.brand strong {
    display: block;
    max-width: 185px;
    font-size: 17px;
    letter-spacing: .02em;
    line-height: 1.25;
}

.brand span {
    display: block;
    margin-top: 4px;
    color: rgba(247, 243, 232, .62);
    font-size: 13px;
}

.menu-scroll { height: calc(100vh - 96px); }

.side-menu {
    border: 0;
    background: transparent;
}

.side-menu .el-sub-menu .el-menu {
    background: transparent;
}

.side-menu .el-sub-menu.is-opened,
.side-menu .el-sub-menu.is-opened .el-menu {
    background: rgba(255,255,255,.045);
}

.side-menu .el-menu-item,
.side-menu .el-sub-menu__title {
    margin: 4px 14px;
    border-radius: 14px;
    color: rgba(247, 243, 232, .72);
}

.side-menu .el-menu-item.is-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(213,139,42,.92), rgba(36,107,75,.78));
}

.side-menu .el-menu-item:hover,
.side-menu .el-sub-menu__title:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 92px;
    padding: 20px 30px;
}

.topbar h1,
.table-toolbar h2,
.hero-card h2 {
    margin: 0;
    font-family: "Source Han Serif SC", "Noto Serif SC", serif;
    font-weight: 800;
    letter-spacing: -.02em;
}

.topbar h1 { font-size: 30px; }

.eyebrow {
    margin: 0 0 6px;
    color: var(--amber);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.topbar-actions,
.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-chip {
    color: var(--muted);
    font-weight: 700;
}

.el-button.is-disabled.el-button--danger.is-link,
.el-button.is-disabled.is-link {
    color: #b8b8b8;
}

.el-popper.is-dark,
.el-popper.el-tooltip,
.table-overflow-tooltip {
    max-width: 460px;
    text-align: left;
    line-height: 1.55;
    word-break: break-all;
    white-space: normal;
}

.table-overflow-tooltip {
    transform-origin: left top !important;
    pointer-events: none;
}

.cell-ellipsis {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.el-table .el-table__cell .cell {
    min-width: 0;
}

.nowrap-table-header .cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.el-table .abnormal-inspection-row > .el-table__cell {
    background: #fff1f3 !important;
}

.el-table .abnormal-inspection-row:hover > .el-table__cell {
    background: #ffe6eb !important;
}

.el-table .pending-patrol-row > .el-table__cell {
    background: #fff5f6 !important;
}

.el-table .pending-patrol-row:hover > .el-table__cell {
    background: #ffecef !important;
}

.abnormal-inspection-row .el-tag.el-tag--danger {
    border-color: #c9183a;
    background: #c9183a;
    color: #fff;
    font-weight: 800;
}

.el-dialog .el-form-item__label {
    white-space: nowrap;
}

.el-table__fixed-right .el-button + .el-button,
.el-table__fixed-right .el-button + .el-popconfirm,
.el-table__fixed-right .el-popconfirm + .el-popconfirm,
.el-table__fixed-right .el-popconfirm + .el-button {
    margin-left: 6px;
}

.patrol-record-action {
    margin: 0 6px 0 0;
    padding: 0;
    border: 0;
    color: #246bdb;
    background: transparent;
    font: inherit;
    line-height: inherit;
    cursor: pointer;
}

.patrol-record-action:hover {
    color: #174fa8;
}

.patrol-detail-image {
    margin: 0 0 16px;
    text-align: center;
}

.patrol-detail-image img {
    display: inline-block;
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    object-fit: contain;
}

.content { padding: 8px 30px 30px; }

.qr-preview {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 12px 0 4px;
    text-align: center;
}

.qr-code-box {
    display: grid;
    width: 240px;
    height: 240px;
    place-items: center;
    border: 1px solid rgba(23, 37, 31, .12);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(23, 37, 31, .12);
}

.qr-preview strong {
    color: var(--ink);
    font-size: 18px;
}

.qr-preview code {
    max-width: 340px;
    padding: 7px 10px;
    overflow-wrap: anywhere;
    border-radius: 10px;
    background: rgba(23, 37, 31, .06);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.qr-preview span {
    max-width: 320px;
    color: var(--muted);
}

.hero-card {
    position: relative;
    display: flex;
    min-height: 108px;
    overflow: hidden;
    align-items: center;
    justify-content: space-between;
    padding: 18px 26px;
    border: 1px solid rgba(36,107,75,.14);
    border-radius: 34px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.92), rgba(241,233,211,.72)),
        radial-gradient(circle at 80% 50%, rgba(36,107,75,.24), transparent 18rem);
    box-shadow: 0 24px 70px rgba(56, 70, 58, .13);
}

.hero-card h2 {
    max-width: 650px;
    font-size: 22px;
    line-height: 1.25;
}

.hero-card p:last-child {
    color: var(--muted);
    font-size: 14px;
    margin: 8px 0 0;
}

.hero-orbit {
    width: 92px;
    height: 92px;
    border: 16px solid rgba(36,107,75,.16);
    border-top-color: rgba(213,139,42,.66);
    border-radius: 50%;
    animation: orbit 9s linear infinite;
}

@keyframes orbit {
    to { transform: rotate(360deg); }
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 20px 0;
}

.metric-card,
.table-card,
.chart-card {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--card);
    box-shadow: 0 18px 48px rgba(56, 70, 58, .10);
    backdrop-filter: blur(14px);
}

.metric-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 56px rgba(56, 70, 58, .16);
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -24px;
    top: -24px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: currentColor;
    opacity: .13;
}

.metric-card span {
    color: var(--muted);
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin-top: 16px;
    font-size: 42px;
}

.metric-split-value {
    display: flex !important;
    align-items: baseline;
    gap: 8px;
}

.metric-split-value em,
.metric-split-value i {
    font-style: normal;
}

.metric-split-value b {
    color: rgba(40, 54, 43, .28);
    font-size: 30px;
}

.metric-split-value i {
    color: #e8a0a0;
}

.metric-tooltip-stats {
    display: grid;
    gap: 6px;
    min-width: 150px;
    line-height: 1.5;
}

.tone-green { color: var(--green); }
.tone-blue { color: var(--blue); }
.tone-orange { color: var(--amber); }
.tone-red { color: var(--red); }

.panel-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 18px;
}

#trendChart { height: 330px; }

.recent-log-card .el-card__body {
    height: 330px;
    overflow-y: auto;
    padding-right: 18px;
}

.recent-log-list {
    min-height: 100%;
}

.recent-log-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-log-place {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.resource-stat-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.resource-stat-item {
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(36, 107, 75, .10), rgba(213, 139, 42, .10));
    border: 1px solid var(--line);
}

.resource-stat-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.resource-stat-item strong {
    display: block;
    margin-top: 6px;
    color: var(--ink);
    font-size: 24px;
}

.device-stat-tooltip {
    max-height: 260px;
    overflow-y: auto;
    min-width: 180px;
    line-height: 1.8;
}

.device-stat-location-total {
    font-weight: 700;
    color: #fff;
}

.device-stat-divider {
    border-top: 1px solid rgba(255, 255, 255, .35);
    margin: 6px 0;
}

.patrol-log-groups {
    border: 0;
}

.patrol-log-groups .el-collapse-item {
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid rgba(36,107,75,.14);
    border-radius: 18px;
    background: rgba(255,255,255,.72);
}

.patrol-log-groups .el-collapse-item__header {
    height: 54px;
    padding: 0 18px;
    border-bottom-color: rgba(36,107,75,.1);
    background: linear-gradient(90deg, rgba(36,107,75,.09), rgba(213,139,42,.08));
}

.patrol-log-groups .el-collapse-item__content {
    padding: 14px;
}

.patrol-log-group-title {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.patrol-log-group-title strong {
    overflow: hidden;
    color: #173c2a;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.patrol-log-group-title strong span {
    margin-left: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.patrol-log-stats {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
}

.toolbar-actions .el-input { width: 260px; }
.toolbar-actions .inspection-log-keyword { width: 180px; min-width: 180px; flex: 0 0 180px; }
.toolbar-actions .inspection-log-select { width: 180px; min-width: 180px; flex: 0 0 180px; }
.toolbar-actions .el-date-editor { width: 360px; }
.toolbar-actions .inspection-log-time-picker { width: 360px; min-width: 360px; flex: 0 0 360px; }
.toolbar-actions .expiry-status-select { width: 150px; min-width: 150px; flex: 0 0 150px; }

.point-selection-summary {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.point-selection-summary .el-textarea { margin-top: 6px; }
.point-selection-summary textarea { max-height: 112px; overflow-y: auto; }

.el-table .expiring-device-row > td.el-table__cell {
    background: #fff0f0 !important;
    color: #b42318;
}

.pager {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.simple-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.pager-total {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.pager-size {
    width: 104px;
}

.schedule-time-block,
.schedule-people-picker {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.schedule-time-block .el-date-editor,
.schedule-people-picker .el-input {
    flex: 1;
}

.form-full-control,
.form-full-control.el-select {
    width: 100%;
}

.schedule-duration {
    min-width: 110px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.people-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.el-card {
    border-radius: 24px;
}

@media (max-width: 980px) {
    .sidebar { width: 220px !important; }
    .metric-grid,
    .panel-grid { grid-template-columns: 1fr; }
    .table-toolbar { align-items: flex-start; flex-direction: column; }
    .topbar { height: auto; align-items: flex-start; flex-direction: column; gap: 12px; }
}
