:root {
    color-scheme: light;
    --ops-canvas: #eef1f4;
    --ops-paper: #ffffff;
    --ops-paper-soft: #f7f8f9;
    --ops-ink: #17212b;
    --ops-ink-secondary: #52606d;
    --ops-ink-muted: #7b8792;
    --ops-line: #dce2e7;
    --ops-line-strong: #c5cfd7;
    --ops-blue: #2563eb;
    --ops-blue-dark: #194ebc;
    --ops-green: #238566;
    --ops-amber: #b97316;
    --ops-red: #c44747;
    --ops-night: #11171c;
    --ops-night-deep: #080c0f;
    --ops-night-surface: #1b232a;
    --ops-night-line: #3f4b55;
    --ops-night-ink: #e6edf2;
    --ops-night-muted: #aeb9c2;
    --ops-sky: #8bc9ef;
    --ops-font-body: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
    --ops-font-display: Bahnschrift, "Microsoft YaHei UI", "Segoe UI", sans-serif;
    --ops-font-data: "Cascadia Mono", Consolas, monospace;
    --ops-text-caption: 13px;
    --ops-text-label: 14px;
    --ops-text-body: 15px;
    --ops-text-title: 17px;
    --ops-control-height: 40px;
    --ops-focus-ring: 0 0 0 3px rgba(37, 99, 235, .09);
    --ops-radius-sm: 6px;
    --ops-radius-md: 10px;
    --ops-radius-lg: 14px;
    --ops-shadow-sm: 0 1px 2px rgba(23, 33, 43, .06), 0 8px 24px rgba(23, 33, 43, .05);
    --ops-shadow-lg: 0 24px 70px rgba(23, 33, 43, .16);
}

* { box-sizing: border-box; }

html,
body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    color: var(--ops-ink);
    background: var(--ops-canvas);
    font-family: var(--ops-font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
::selection { color: #fff; background: var(--ops-blue); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 10px;
    background: #aeb9c2;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #87949f; background-clip: padding-box; }

a { color: var(--ops-blue); }
a:hover { color: var(--ops-blue-dark); }

:focus-visible {
    outline: 2px solid rgba(37, 99, 235, .72);
    outline-offset: 2px;
}

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 20px;
}

.page-intro__kicker { display: none; }

.page-intro h1 {
    margin: 0;
    color: var(--ops-ink);
    font-size: clamp(24px, 2vw, 31px);
    font-weight: 720;
    line-height: 1.25;
    letter-spacing: -.025em;
}

.page-intro p {
    max-width: 760px;
    margin: 7px 0 0;
    color: var(--ops-ink-secondary);
    font-size: 16px;
    line-height: 1.65;
}

.page-intro__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.page-intro__chip {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    color: var(--ops-ink-secondary);
    font-size: 14px;
    font-weight: 620;
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius-sm);
    background: var(--ops-paper);
}

.page-intro__chip--active {
    color: #17634e;
    border-color: #b7d9cd;
    background: #edf8f4;
}

.ant-card {
    overflow: hidden;
    color: var(--ops-ink);
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius-lg);
    background: var(--ops-paper);
    box-shadow: var(--ops-shadow-sm);
}

.ant-card-bordered { border-color: var(--ops-line); }

.ant-card-head {
    min-height: 58px;
    padding: 0 20px;
    color: var(--ops-ink);
    border-bottom: 1px solid #e7ebee;
    background: var(--ops-paper);
}

.ant-card-head-wrapper { gap: 14px; }

.ant-card-head-title {
    padding: 17px 0;
    color: var(--ops-ink);
    font-size: var(--ops-text-title);
    font-weight: 690;
    line-height: 1.4;
}

.ant-card-extra {
    min-width: 0;
    padding: 11px 0;
}

.ant-card-body { padding: 20px; }

.ant-statistic-title {
    margin-bottom: 7px;
    color: var(--ops-ink-secondary);
    font-size: var(--ops-text-label);
    font-weight: 570;
}

.ant-statistic-content,
.ant-statistic-content-value {
    color: var(--ops-ink);
    font-variant-numeric: tabular-nums;
}

.ant-btn {
    min-height: var(--ops-control-height);
    padding: 4px 14px;
    color: #34414d;
    font-size: var(--ops-text-body);
    font-weight: 640;
    border-color: #c8d1d8;
    border-radius: var(--ops-radius-sm);
    background: #fff;
    box-shadow: 0 1px 1px rgba(23, 33, 43, .04);
    transition: color 130ms ease, border-color 130ms ease, background 130ms ease, box-shadow 130ms ease;
}

.ant-btn-sm {
    min-height: 36px;
    padding: 2px 11px;
    font-size: 14px;
}

.ant-btn:hover,
.ant-btn:focus {
    color: var(--ops-blue);
    border-color: #7ca2ee;
    background: #f7f9ff;
}

.ant-btn-primary {
    color: #fff;
    border-color: var(--ops-blue);
    background: var(--ops-blue);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .18);
}

.ant-btn-primary:hover,
.ant-btn-primary:focus {
    color: #fff;
    border-color: var(--ops-blue-dark);
    background: var(--ops-blue-dark);
}

.ant-btn-dangerous,
.ant-btn-primary.ant-btn-dangerous {
    color: #ae3434;
    border-color: #e2bbbb;
    background: #fff8f8;
    box-shadow: none;
}

.ant-btn-dangerous:hover,
.ant-btn-primary.ant-btn-dangerous:hover {
    color: #912828;
    border-color: #cc7777;
    background: #fff1f1;
}

.ant-btn-link {
    color: var(--ops-blue);
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.ant-btn[disabled],
.ant-btn[disabled]:hover {
    color: #a0a9b1;
    border-color: #e0e5e9;
    background: #f5f6f7;
    box-shadow: none;
}

.ant-input,
.ant-input-number,
.ant-select:not(.ant-select-customize-input) .ant-select-selector,
textarea.ant-input,
select.ant-input {
    min-height: var(--ops-control-height);
    color: var(--ops-ink);
    font-size: var(--ops-text-body);
    border-color: #c8d1d8;
    border-radius: var(--ops-radius-sm);
    background: #fff;
    box-shadow: none;
}

.ant-select-single:not(.ant-select-customize-input) .ant-select-selector {
    height: 40px;
    padding-top: 4px;
}

.ant-input:hover,
.ant-input:focus,
.ant-input-number:hover,
.ant-input-number-focused,
.ant-select:not(.ant-select-disabled):hover .ant-select-selector,
.ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector {
    border-color: #7398e8;
    box-shadow: var(--ops-focus-ring);
}

.ant-input::placeholder,
textarea.ant-input::placeholder,
.ant-select-selection-placeholder { color: #96a0aa; }

.ant-form-item { margin-bottom: 16px; }

.ant-form-item-label > label,
.ant-descriptions-item-label,
.ant-divider-inner-text {
    color: var(--ops-ink-secondary);
    font-size: var(--ops-text-body);
}

.ant-divider-horizontal.ant-divider-with-text {
    color: #46535f;
    font-size: 14px;
    border-top-color: var(--ops-line);
}

.ant-table,
.ant-table-container,
.ant-table-content,
.ant-table-tbody > tr > td {
    color: #34414d;
    font-size: var(--ops-text-body);
    background: transparent;
}

.ant-table-wrapper { overflow-x: auto; }

.ant-table-thead > tr > th {
    padding-top: 12px;
    padding-bottom: 12px;
    color: #5c6975;
    font-size: var(--ops-text-label);
    font-weight: 660;
    border-bottom: 1px solid var(--ops-line);
    background: #f5f7f8;
}

.ant-table-tbody > tr > td { border-bottom: 1px solid #e8ecef; }
.ant-table-tbody > tr.ant-table-row:hover > td { background: #f6f8fa; }
.ant-table-placeholder:hover > td { background: transparent !important; }

.ant-descriptions { color: var(--ops-ink-secondary); }

.ant-descriptions-bordered .ant-descriptions-view {
    overflow: hidden;
    border-color: var(--ops-line);
    border-radius: var(--ops-radius-md);
}

.ant-descriptions-bordered .ant-descriptions-item-label,
.ant-descriptions-bordered .ant-descriptions-item-content {
    padding: 11px 13px;
    border-color: var(--ops-line);
}

.ant-descriptions-bordered .ant-descriptions-item-label { background: #f4f6f7; }
.ant-descriptions-bordered .ant-descriptions-item-content {
    color: #2d3944;
    background: #fff;
}

.ant-alert {
    color: #34414d;
    font-size: var(--ops-text-body);
    border: 1px solid #c8d9e8;
    border-radius: var(--ops-radius-md);
    background: #f2f8fc;
}

.ant-alert-success { border-color: #b9ddcf; background: #f0f8f5; }
.ant-alert-warning { border-color: #e5d1aa; background: #fff9ec; }
.ant-alert-error { border-color: #e5bcbc; background: #fff5f5; }
.ant-alert-message,
.ant-alert-description { color: inherit; }
.ant-alert-description { margin-top: 3px; line-height: 1.55; }

.ant-tag {
    padding: 1px 8px;
    font-size: var(--ops-text-label);
    line-height: 22px;
    border-radius: 5px;
}

.ant-empty-description,
.ant-pagination,
.ant-pagination-item a { color: var(--ops-ink-muted); }

.ant-empty-description { font-size: var(--ops-text-body); }

.ant-form-item-explain,
.ant-form-item-extra,
.ant-select-item,
.ant-dropdown-menu-item,
.ant-message-notice-content,
.ant-spin-text {
    font-size: var(--ops-text-label);
    line-height: 1.55;
}

.ant-message-notice-content {
    color: var(--ops-ink);
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius-md);
    background: var(--ops-paper);
    box-shadow: var(--ops-shadow-lg);
}

.ant-pagination-item,
.ant-pagination-prev .ant-pagination-item-link,
.ant-pagination-next .ant-pagination-item-link {
    border-color: var(--ops-line);
    border-radius: 5px;
    background: #fff;
}

.ant-pagination-item-active {
    border-color: var(--ops-blue);
    background: #f4f7ff;
}

.ant-space { max-width: 100%; }

.admin-permission-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.admin-permission-item {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    color: #3d4a56;
    font-size: 15px;
    border: 1px solid var(--ops-line);
    border-radius: 7px;
    background: #f7f8f9;
}

.map-host {
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--ops-line-strong);
    border-radius: var(--ops-radius-md);
    background: #dce4e8;
}

.video-player {
    width: 100%;
    min-height: 320px;
    border-radius: var(--ops-radius-md);
    background: #080b0e;
}

.login-page {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.login-card {
    width: min(440px, 94vw);
    padding: 36px;
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius-lg);
    background: #fff;
    box-shadow: var(--ops-shadow-lg);
}

.login-card h1 {
    margin: 0 0 6px;
    color: var(--ops-ink);
    font-size: 28px;
    line-height: 1.3;
    letter-spacing: -.02em;
}

.login-subtitle,
.login-tip {
    color: var(--ops-ink-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.workspace-card { position: relative; }

.workspace-card .ant-card-body > .ant-space,
.workspace-card .ant-card-body > .ant-row { min-width: 0; }

.workspace-card .ant-table-wrapper {
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius-md);
    background: #fff;
}

.workspace-card textarea.ant-input {
    font-family: var(--ops-font-data) !important;
    font-size: 14px;
    line-height: 1.65;
}

/* Management workspace: dense enough for operations, calm enough for daily use. */
.management-page {
    width: min(100%, 1760px);
    margin: 0 auto;
}

.management-page__intro { margin-bottom: 16px; }

.management-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(132px, 1fr));
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius-md);
    background: var(--ops-paper);
    box-shadow: var(--ops-shadow-sm);
}

.management-summary--compact { grid-template-columns: repeat(4, minmax(150px, 1fr)); }

.management-summary__item {
    position: relative;
    min-height: 82px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 18px 20px;
    border-right: 1px solid #e6eaed;
}

.management-summary__item:last-child { border-right: 0; }

.management-summary__item::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #cbd3d9;
}

.management-summary__item--success::before { background: var(--ops-green); }
.management-summary__item--warning::before { background: var(--ops-amber); }

.management-summary__item span {
    align-self: flex-start;
    color: var(--ops-ink-secondary);
    font-size: 14px;
    font-weight: 600;
}

.management-summary__item strong {
    margin-left: auto;
    color: var(--ops-ink);
    font-family: var(--ops-font-display);
    font-size: 30px;
    font-weight: 650;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.management-summary__item small {
    color: var(--ops-ink-muted);
    font-size: var(--ops-text-caption);
}

.management-layout {
    min-width: 0;
    display: grid;
    gap: 16px;
    align-items: start;
}

.management-layout--with-aside { grid-template-columns: minmax(0, 1fr) minmax(330px, 390px); }

.management-aside {
    min-width: 0;
    display: grid;
    gap: 16px;
}

.management-aside--user-editor { position: relative; }

.management-panel { min-width: 0; }
.management-panel .ant-card-body { min-width: 0; }

.management-panel__hint {
    margin: 0 0 18px;
    color: var(--ops-ink-secondary);
    font-size: var(--ops-text-label);
    line-height: 1.65;
}

.management-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #e2e7ea;
    border-radius: 9px;
    background: #f7f8f9;
}

.management-field {
    min-width: 190px;
    display: grid;
    gap: 6px;
    color: #4b5965;
    font-size: var(--ops-text-label);
    font-weight: 620;
}

.management-field--grow { min-width: 240px; flex: 1 1 auto; }

.management-toolbar__count {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0 4px;
    color: var(--ops-ink-muted);
    font-size: var(--ops-text-label);
    font-variant-numeric: tabular-nums;
}

.management-table {
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--ops-line);
    border-radius: 9px;
    background: var(--ops-paper);
}

.management-table .ant-table-wrapper { min-width: 760px; }
.management-table .ant-table-tbody > tr > td { padding-top: 14px; padding-bottom: 14px; }

.management-table--users .ant-table-wrapper { min-width: 940px; }
.management-table--users .ant-table-tbody > tr > td:nth-child(2) { white-space: nowrap; }
.management-table--users .ant-table-tbody > tr > td:nth-child(3) { min-width: 320px; }
.management-table--users .ant-tag { margin: 2px 4px 2px 0; white-space: nowrap; }

.management-editor-anchor {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    outline: none;
}

.table-identity,
.table-primary,
.table-secondary {
    display: block;
}

.table-identity strong,
.table-primary {
    color: #26333e;
    font-weight: 650;
}

.table-identity span,
.table-secondary {
    margin-top: 3px;
    color: var(--ops-ink-muted);
    font-size: var(--ops-text-caption);
    line-height: 1.45;
}

.table-mono {
    font-family: var(--ops-font-data);
    font-variant-numeric: tabular-nums;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #52606d;
    font-size: var(--ops-text-label);
    font-weight: 640;
}

.status-pill > span {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #929da5;
}

.status-pill--success { color: #17634e; }
.status-pill--success > span { background: var(--ops-green); }
.status-pill--muted > span { background: #9aa4ac; }

.audit-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #dfe5e9;
    border-radius: 9px;
    background: #f7f8f9;
}

.audit-filter__actions {
    display: flex;
    gap: 8px;
}

.audit-operator {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    margin-right: 8px;
    color: #315d78;
    font-size: 13px;
    font-weight: 740;
    border: 1px solid #c1d2dc;
    border-radius: 50%;
    background: #edf5f8;
}

.audit-message {
    display: block;
    min-width: 220px;
    max-width: 560px;
    color: #3c4954;
    line-height: 1.55;
    white-space: normal;
}

.audit-table .ant-table-wrapper { min-width: 980px; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    top: .5rem;
    right: .75rem;
}

@media (max-width: 760px) {
    .page-intro { align-items: flex-start; flex-direction: column; gap: 12px; }
    .page-intro__meta { flex-wrap: wrap; }
    .ant-card-head,
    .ant-card-body { padding-right: 15px; padding-left: 15px; }
    .ant-card-extra { max-width: 68%; }
    .admin-permission-list { grid-template-columns: 1fr; }
}

@media (max-width: 1280px) {
    .management-layout--with-aside { grid-template-columns: minmax(0, 1fr); }
    .management-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .management-aside--user-editor { grid-template-columns: minmax(0, 1fr); }
    .management-summary { overflow-x: auto; }
    .audit-filter { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 820px) {
    .management-summary,
    .management-summary--compact {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .management-summary__item { border-bottom: 1px solid #e6eaed; }
    .management-summary__item:nth-child(2n) { border-right: 0; }
    .management-aside,
    .audit-filter { grid-template-columns: 1fr; }
    .management-toolbar { align-items: stretch; flex-direction: column; }
    .management-field,
    .management-field--grow { width: 100%; min-width: 0; }
    .management-toolbar__count { min-height: 24px; }
}

@media (max-width: 520px) {
    .management-summary,
    .management-summary--compact { grid-template-columns: 1fr; }
    .management-summary__item,
    .management-summary__item:nth-child(2n) { border-right: 0; }
    .audit-filter__actions { flex-wrap: wrap; }
}

@media (max-width: 640px) {
    .workspace-card .ant-row > [class*="ant-col-"] {
        max-width: 100%;
        flex: 0 0 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
