* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #102a43;
    background:
        radial-gradient(circle at top left, rgba(18, 183, 106, 0.12), transparent 24%),
        radial-gradient(circle at top right, rgba(28, 100, 242, 0.12), transparent 22%),
        linear-gradient(180deg, #f7fafc 0%, #eef2f7 100%);
}

a {
    color: inherit;
}

.site-header {
    padding: 28px 24px 12px;
}

.header-shell,
.dashboard-shell {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

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

.eyebrow,
.section-label {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #627d98;
}

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

h1 {
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.08;
}

.dashboard-shell {
    padding: 8px 0 36px;
}

.dashboard-grid,
.charts-grid,
.action-grid {
    display: grid;
    gap: 18px;
}

.dashboard-grid {
    grid-template-columns: 1fr;
    margin-bottom: 18px;
}

.action-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
    align-items: start;
    margin-bottom: 18px;
}

.charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 28px;
    margin-bottom: 18px;
}

.hero-title {
    margin-bottom: 14px;
    font-size: clamp(24px, 3vw, 32px);
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    gap: 12px;
    min-width: min(100%, 360px);
}

.metric-card,
.stat-panel {
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(203, 213, 225, 0.7);
    padding: 16px;
}

.metric-label,
.stat-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: #627d98;
}

.metric-card strong,
.stat-panel strong {
    font-size: 20px;
    font-weight: 700;
    color: #102a43;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 14px;
}

.status-chip[data-variant="success"] {
    background: #dcfce7;
    color: #15803d;
}

.status-chip[data-variant="warning"] {
    background: #fef3c7;
    color: #b45309;
}

.status-chip[data-variant="error"] {
    background: #fee2e2;
    color: #b91c1c;
}

.summary-card,
.control-card,
.chart-card,
.command-card {
    padding: 24px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

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

.control-grid {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-size: 13px;
    font-weight: 600;
    color: #334e68;
}

.field select,
.field input,
.command-form input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #fff;
    color: #102a43;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field select:focus,
.field input:focus,
.command-form input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.field-note {
    color: #627d98;
    font-size: 13px;
    line-height: 1.6;
}

.button-row,
.button-stack,
.command-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.button-stack {
    flex-wrap: wrap;
}

.command-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.interval-command-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(203, 213, 225, 0.75);
    border-radius: 16px;
    background: #f8fbff;
}

.interval-command-inline label {
    color: #486581;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.interval-command-inline input {
    width: 96px;
    min-height: 38px;
    border: 1px solid rgba(145, 190, 220, 0.45);
    border-radius: 12px;
    padding: 0 10px;
    color: #102a43;
    font-weight: 700;
    background: #ffffff;
}

.interval-command-inline .preset-btn {
    min-height: 38px;
}

.command-status-panel,
.command-log-panel {
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.command-status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px;
    margin-bottom: 14px;
}

.command-status-panel h3,
.command-log-panel h3 {
    font-size: 18px;
    line-height: 1.3;
}

.command-log-panel {
    margin-top: 18px;
    padding: 18px;
}

.command-log-head {
    margin-bottom: 14px;
}

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

.command-log-item {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 16px;
    background: #ffffff;
}

.command-log-topline,
.command-log-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.command-name {
    font-size: 14px;
    font-weight: 700;
    color: #102a43;
    word-break: break-all;
}

.command-meta {
    color: #627d98;
    font-size: 12px;
}

.command-message {
    color: #334e68;
    font-size: 13px;
    line-height: 1.5;
}

.command-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.command-badge[data-variant="info"] {
    background: #dbeafe;
    color: #1d4ed8;
}

.command-badge[data-variant="success"] {
    background: #dcfce7;
    color: #15803d;
}

.command-badge[data-variant="warning"] {
    background: #fef3c7;
    color: #b45309;
}

.command-badge[data-variant="error"] {
    background: #fee2e2;
    color: #b91c1c;
}

.preset-btn {
    background: #e8f1ff;
    color: #1d4ed8;
    box-shadow: none;
}

.preset-btn:hover {
    box-shadow: none;
}

.preset-btn[data-command-state="pending"],
#send-command-btn[data-command-state="pending"] {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: #ffffff;
}

.preset-btn[data-command-state="success"],
#send-command-btn[data-command-state="success"] {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #ffffff;
}

.preset-btn[data-command-state="warning"],
#send-command-btn[data-command-state="warning"] {
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    color: #ffffff;
}

.preset-btn[data-command-state="error"],
#send-command-btn[data-command-state="error"] {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
}

button,
.back-link {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button {
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24);
}

button:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(255, 255, 255, 0.72);
    color: #102a43;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.ghost-btn {
    background: #ffffff;
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.24);
    box-shadow: none;
}

.ghost-btn:hover {
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.waveform-panel {
    width: 100%;
    height: 340px;
}

.command-form input {
    flex: 1 1 auto;
}

#device-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.meter-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.device-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    padding: 24px;
}

.device-card h2 {
    margin-bottom: 10px;
}

.device-card p {
    margin-bottom: 18px;
    color: #627d98;
    line-height: 1.6;
}

.directory-device-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 240px;
    gap: 14px;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.directory-device-card:hover {
    transform: translateY(-6px);
    border-color: rgba(29, 117, 219, 0.24);
    box-shadow: 0 24px 44px rgba(15, 23, 42, 0.12);
}

.directory-device-card h3 {
    margin-bottom: 0;
    color: #102a43;
    font-size: 30px;
}

.directory-device-card p {
    margin-bottom: 0;
    color: #486579;
}

.directory-device-card .section-label {
    color: #5e7f95;
}

.device-card-topline,
.breaker-card-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.device-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.device-card-tag {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f766e;
    font-size: 12px;
    font-weight: 700;
}

.directory-device-card button {
    width: 100%;
    margin-top: auto;
}

.directory-meter-card h3 {
    font-size: 24px;
}

.directory-meter-card p {
    line-height: 1.7;
}

.inline-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.inline-status-neutral {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.inline-status-online {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.inline-status-offline {
    background: rgba(148, 163, 184, 0.14);
    color: #475569;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex-shrink: 0;
}

.status-dot-neutral {
    background: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

.status-dot-online {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.status-dot-offline {
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18);
}

.home-page {
    font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #dbedf8;
    background:
        radial-gradient(circle at top left, rgba(62, 184, 136, 0.1), transparent 22%),
        radial-gradient(circle at top right, rgba(38, 130, 255, 0.12), transparent 26%),
        linear-gradient(180deg, #f3f8fc 0%, #edf4f8 100%);
}

.home-page .site-header {
    padding: 0;
}

.home-header {
    position: sticky;
    top: 0;
    z-index: 20;
}

.home-nav-shell {
    width: 100%;
    padding: 16px 28px;
    border: 1px solid rgba(145, 190, 220, 0.18);
    border-radius: 0;
    background: rgba(6, 23, 39, 0.78);
    box-shadow: 0 24px 48px rgba(3, 12, 24, 0.28);
    backdrop-filter: blur(16px);
}

.home-page .dashboard-shell {
    width: min(1440px, calc(100% - 40px));
}

.lab-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    min-width: 0;
}

.lab-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 28px rgba(2, 10, 20, 0.28);
    flex-shrink: 0;
}

.lab-brand-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.lab-brand-cn,
.lab-brand-en {
    display: block;
}

.lab-brand-cn {
    color: #f2f8fc;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.lab-brand-en {
    color: rgba(206, 229, 243, 0.8);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.site-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    margin-left: auto;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    color: #dceef8;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(179, 219, 241, 0.12);
}

.site-nav a::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 8px;
    height: 2px;
    transform: scaleX(0);
    transform-origin: left;
    background: linear-gradient(90deg, #3ad1a0 0%, #5ecbff 100%);
    transition: transform 0.2s ease;
}

.site-nav a:hover {
    background: rgba(255, 255, 255, 0.09);
}

.site-nav a:hover::after {
    transform: scaleX(1);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(179, 219, 241, 0.12);
    color: #e5f4fb;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.logout-btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(16, 164, 110, 0.95) 0%, rgba(29, 117, 219, 0.95) 100%);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.18);
}

.nav-toggle {
    display: none;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px auto;
    border-radius: 999px;
    background: #f4fbff;
}

.home-main {
    padding-bottom: 56px;
}

.home-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    min-height: 100svh;
    padding: 24px 0 0;
}

.home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(102deg, rgba(4, 18, 31, 0.9) 4%, rgba(7, 28, 48, 0.72) 46%, rgba(6, 31, 58, 0.2) 100%),
        url("images/home-hero.jpg") center/cover no-repeat;
}

.home-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 72px;
    background: linear-gradient(180deg, rgba(7, 27, 45, 0) 0%, rgba(7, 27, 45, 0.88) 100%);
}

.home-hero-shell {
    position: relative;
    z-index: 1;
    width: min(1480px, calc(100% - 40px));
    min-height: calc(100vh - 128px);
    min-height: calc(100svh - 128px);
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 430px);
    gap: 28px;
    align-items: center;
    padding: 52px 0 64px;
}

.home-hero-copy {
    max-width: 760px;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 18px;
    padding: 8px 14px;
    border: 1px solid rgba(137, 216, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #bbf5da;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.home-hero-title {
    max-width: 760px;
    margin-bottom: 20px;
    color: #f5fbff;
    font-size: clamp(36px, 5vw, 68px);
    line-height: 1.06;
    letter-spacing: -0.03em;
}

.home-hero-text {
    max-width: 720px;
    color: rgba(224, 240, 249, 0.9);
    font-size: 18px;
    line-height: 1.8;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.hero-primary-link,
.hero-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
}

.hero-primary-link {
    color: #f3fbff;
    background: linear-gradient(135deg, #12a06e 0%, #1473dd 100%);
    box-shadow: 0 20px 34px rgba(5, 20, 34, 0.32);
}

.hero-secondary-link {
    color: #e2f2fb;
    border: 1px solid rgba(185, 228, 248, 0.32);
    background: rgba(255, 255, 255, 0.08);
}

.hero-highlight-card {
    border: 1px solid rgba(171, 215, 238, 0.18);
    border-radius: 28px;
    padding: 22px 22px 24px;
    background: linear-gradient(180deg, rgba(10, 38, 62, 0.84) 0%, rgba(8, 28, 48, 0.9) 100%);
    box-shadow: 0 28px 48px rgba(3, 11, 22, 0.26);
    backdrop-filter: blur(14px);
}

.login-card {
    justify-self: end;
    width: min(100%, 430px);
    align-self: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-field {
    display: grid;
    gap: 8px;
}

.login-field span {
    color: #d8eef9;
    font-size: 13px;
    font-weight: 700;
}

.login-field input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(176, 218, 239, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: #f4fbff;
    font-size: 14px;
    outline: none;
}

.login-field input::placeholder {
    color: rgba(213, 233, 245, 0.58);
}

.login-field input:focus {
    border-color: rgba(94, 203, 255, 0.72);
    box-shadow: 0 0 0 4px rgba(45, 159, 225, 0.14);
}

.login-submit-btn {
    margin-top: 4px;
    min-height: 50px;
    background: linear-gradient(135deg, #16a46e 0%, #1d75db 100%);
}

.auth-feedback {
    min-height: 22px;
    color: #ffdbdb;
    font-size: 13px;
    line-height: 1.6;
}

.auth-feedback[data-variant="success"] {
    color: #b9f6d7;
}

.auth-feedback[data-variant="info"] {
    color: #dceef8;
}

.hero-highlight-card h2 {
    margin-bottom: 18px;
    color: #f3fbff;
    font-size: 26px;
    line-height: 1.25;
}

.hero-highlight-grid {
    display: grid;
    gap: 14px;
}

.hero-highlight-item {
    padding: 18px;
    border: 1px solid rgba(166, 217, 239, 0.12);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.hero-highlight-item span {
    display: block;
    margin-bottom: 8px;
    color: #7be3b9;
    font-size: 30px;
    font-weight: 800;
}

.hero-highlight-item p {
    color: rgba(226, 241, 249, 0.86);
    line-height: 1.7;
}

.home-section {
    padding: 44px 0;
}

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

.home-section-head h2,
.environment-copy h2,
.home-footer h2 {
    color: #102a43;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.1;
}

.home-page .field-note {
    color: #5a768b;
}

.research-section {
    position: relative;
    padding: 80px 0 90px;
    background: linear-gradient(180deg, #0a2741 0%, #0b2944 100%);
}

.research-section .dashboard-shell,
.lab-section .dashboard-shell {
    width: min(1440px, calc(100% - 40px));
}

#projects .section-label,
.research-section .section-label {
    color: rgba(168, 212, 236, 0.82);
}

#projects .home-section-head h2,
.research-section .home-section-head h2 {
    color: #eef8fe;
    text-shadow: 0 10px 24px rgba(2, 11, 20, 0.24);
}

#projects .home-section-head .field-note {
    color: rgba(212, 231, 244, 0.84);
}

.lab-section {
    padding: 80px 0 88px;
    background: linear-gradient(180deg, #f3f8fc 0%, #edf4f8 100%);
}

.environment-section .section-label {
    color: #627d98;
}

.environment-section .environment-copy h2 {
    color: #102a43;
    text-shadow: none;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 22px;
    margin-top: 28px;
}

.project-card,
.info-card,
.news-card,
.home-device-card {
    border: 1px solid rgba(111, 204, 234, 0.22);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(73, 120, 166, 0.08) 100%),
        rgba(7, 28, 48, 0.68);
    box-shadow:
        0 20px 36px rgba(2, 11, 20, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
}

.project-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 308px;
    padding: 24px;
    text-decoration: none;
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
}

.project-index {
    margin-bottom: 0;
    color: #b7daf0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.22em;
}

.entry-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.entry-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    border: 1px solid rgba(111, 204, 234, 0.24);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.entry-icon svg {
    width: 26px;
    height: 26px;
    stroke: #6fe1d2;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.project-card h3,
.info-card h3,
.news-card h3,
.home-device-card h3 {
    margin-bottom: 12px;
    color: #f4fbff;
    font-size: 28px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.project-card p,
.info-card p,
.news-card p,
.home-device-card p {
    color: rgba(215, 234, 245, 0.84);
    line-height: 1.8;
}

.project-entry-card p:nth-of-type(2),
.info-link-card p,
.news-link-card p {
    font-size: 13px;
    line-height: 1.7;
}

.entry-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    color: #79dfe2;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    opacity: 0.8;
    transition: opacity 0.24s ease, transform 0.24s ease, color 0.24s ease;
}

.project-entry-card:hover,
.info-link-card:hover,
.news-link-card:hover {
    transform: translateY(-8px);
    border-color: rgba(111, 225, 210, 0.46);
    box-shadow:
        0 24px 46px rgba(2, 12, 22, 0.36),
        0 0 28px rgba(58, 168, 232, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.project-entry-card:hover .entry-link,
.info-link-card:hover .entry-link,
.news-link-card:hover .entry-link {
    opacity: 1;
    color: #a2f1ea;
    transform: translateX(4px);
}

.project-entry-card:hover .entry-icon {
    border-color: rgba(111, 225, 210, 0.42);
    box-shadow: 0 0 18px rgba(69, 192, 214, 0.18);
}

.home-device-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(240, 248, 252, 0.98) 100%);
}

.home-device-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #0f9f72 0%, #1d75db 100%);
}

.home-device-card .section-label {
    color: #5e7f95;
}

.environment-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 24px;
    align-items: center;
    margin-top: 0;
}

.environment-section {
    padding-top: 0;
}

.environment-copy p {
    color: #486579;
    line-height: 1.85;
    margin-top: 18px;
}

.environment-figure {
    margin: 0;
    overflow: hidden;
    border-radius: 30px;
    border: 1px solid rgba(141, 178, 201, 0.22);
    box-shadow: 0 24px 40px rgba(15, 43, 67, 0.12);
}

.environment-figure img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.info-card,
.news-card {
    position: relative;
    overflow: hidden;
    display: grid;
    min-height: 248px;
    padding: 24px;
    text-decoration: none;
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.news-tag {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: 14px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(99, 197, 225, 0.12);
    color: #bce9f7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.home-footer {
    margin-top: 22px;
    padding: 34px 0 48px;
    background: linear-gradient(180deg, #081c2f 0%, #071521 100%);
}

.detail-page {
    color: #dbedf8;
    background:
        radial-gradient(circle at top left, rgba(62, 184, 136, 0.2), transparent 20%),
        radial-gradient(circle at top right, rgba(38, 130, 255, 0.18), transparent 24%),
        linear-gradient(180deg, #081a2b 0%, #0b2741 52%, #0a2136 100%);
}

.detail-header {
    padding: 0;
}

.detail-nav-shell {
    width: 100%;
}

.detail-main {
    padding: 34px 0 56px;
}

.detail-hero {
    width: min(1380px, calc(100% - 40px));
    padding: 24px 0 18px;
}

.detail-hero h1 {
    margin: 10px 0 14px;
    color: #f4fbff;
    font-size: clamp(36px, 5vw, 60px);
    line-height: 1.05;
}

.detail-summary {
    max-width: 820px;
    color: rgba(216, 233, 245, 0.88);
    font-size: 18px;
    line-height: 1.8;
}

.detail-content-grid {
    width: min(1380px, calc(100% - 40px));
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 24px;
}

.detail-content-card,
.detail-side-card {
    border: 1px solid rgba(111, 204, 234, 0.2);
    border-radius: 28px;
    padding: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(73, 120, 166, 0.07) 100%),
        rgba(7, 28, 48, 0.72);
    box-shadow: 0 22px 40px rgba(2, 11, 20, 0.28);
    backdrop-filter: blur(12px);
}

.detail-content-card h2,
.detail-side-card h2 {
    margin-bottom: 18px;
    color: #f3fbff;
    font-size: 28px;
}

.detail-content-card p,
.detail-side-card li {
    color: rgba(216, 233, 245, 0.86);
    line-height: 1.9;
    font-size: 16px;
}

.detail-content-card p + p {
    margin-top: 18px;
}

.detail-points {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
}

.detail-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 24px;
    padding: 0 18px;
    border-radius: 999px;
    text-decoration: none;
    color: #f3fbff;
    font-weight: 700;
    background: linear-gradient(135deg, #12a06e 0%, #1473dd 100%);
}

.device-directory-page {
    color: #102a43;
}

.directory-header {
    padding: 0;
}

.directory-nav-shell {
    width: 100%;
}

.directory-main {
    width: min(1440px, calc(100% - 40px));
    padding: 18px 0 48px;
}

.directory-sections {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 22px;
    align-items: start;
}

.device-detail-page {
    color: #102a43;
}

.device-detail-page .hero-card,
.directory-hero-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(29, 117, 219, 0.14), transparent 26%),
        radial-gradient(circle at bottom left, rgba(15, 159, 114, 0.12), transparent 28%),
        rgba(255, 255, 255, 0.94);
}

.device-detail-page .hero-card::after,
.directory-hero-card::after {
    content: "";
    position: absolute;
    right: -48px;
    bottom: -68px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0) 72%);
    pointer-events: none;
}

.device-header {
    padding: 0;
}

.device-nav-shell {
    width: 100%;
}

.directory-hero-card {
    margin-bottom: 22px;
}

.directory-copy,
.device-hero-copy,
.directory-summary {
    position: relative;
    z-index: 1;
}

.directory-title {
    margin-bottom: 14px;
}

.directory-intro {
    max-width: 640px;
}

.directory-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: min(100%, 640px);
}

.hero-subtitle {
    margin-bottom: 16px;
    max-width: 540px;
}

.directory-list-shell {
    padding: 26px;
}

.directory-module {
    padding: 26px;
}

.directory-module-head {
    align-items: flex-end;
    margin-bottom: 20px;
}

.directory-module-head h2 {
    font-size: 32px;
    line-height: 1.08;
}

.directory-module-head .section-label {
    font-size: 12px;
}

.directory-module-head .field-note {
    max-width: 420px;
}

.device-type-label {
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: 0.08em;
    color: #385a72;
}

.breaker-module-head {
    margin-bottom: 18px;
}

.breaker-head-meta {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.breaker-summary-strip,
.device-summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.breaker-summary-card,
.device-summary-card {
    border-radius: 18px;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(203, 213, 225, 0.7);
}

.breaker-summary-card strong,
.device-summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
    color: #102a43;
}

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

.breaker-card,
.directory-meter-card {
    border-radius: 22px;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 249, 253, 0.98) 100%);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.breaker-card h3,
.directory-meter-card h3 {
    margin-top: 2px;
    font-size: 24px;
    color: #102a43;
}

.breaker-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.breaker-fact {
    display: grid;
    gap: 6px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(203, 213, 225, 0.65);
}

.breaker-fact span {
    font-size: 12px;
    color: #627d98;
}

.breaker-fact strong {
    font-size: 15px;
    line-height: 1.4;
    color: #102a43;
    word-break: break-word;
}

.breaker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.breaker-actions button {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 96px;
}

.breaker-action-primary {
    background: linear-gradient(135deg, #0f9f72 0%, #11835e 100%);
    box-shadow: 0 12px 24px rgba(15, 159, 114, 0.24);
}

.breaker-action-primary:hover {
    box-shadow: 0 16px 30px rgba(15, 159, 114, 0.28);
}

.breaker-feedback {
    min-height: 20px;
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #486579;
}

.breaker-feedback[data-variant="success"] {
    color: #15803d;
}

.breaker-feedback[data-variant="warning"] {
    color: #b45309;
}

.breaker-feedback[data-variant="error"] {
    color: #b91c1c;
}

.directory-list-head {
    align-items: flex-end;
    margin-bottom: 22px;
}

.directory-list-head .field-note {
    max-width: 520px;
}

.directory-summary .metric-card {
    background: rgba(255, 255, 255, 0.9);
}

.footer-shell {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.home-footer .section-label,
.home-footer h2,
.footer-copy,
.footer-links a {
    color: #eff8fd;
}

.footer-copy {
    margin-top: 10px;
    line-height: 1.8;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(185, 222, 240, 0.18);
}

@media (max-width: 960px) {
    .dashboard-grid,
    .charts-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .directory-sections,
    .breaker-list,
    .meter-list,
    .breaker-summary-strip,
    .device-summary-strip {
        grid-template-columns: 1fr;
    }

    .directory-summary {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        min-width: 100%;
    }

    .hero-card {
        flex-direction: column;
    }

    .hero-meta {
        width: 100%;
        min-width: 0;
    }

    .home-nav-shell {
        position: relative;
        padding: 14px 16px;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    .site-menu {
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding: 18px;
        border: 1px solid rgba(145, 190, 220, 0.18);
        border-radius: 24px;
        background: rgba(6, 23, 39, 0.96);
        box-shadow: 0 18px 30px rgba(1, 10, 18, 0.26);
    }

    .site-menu.is-open {
        display: flex;
    }

    .site-nav,
    .site-menu {
        align-items: stretch;
    }

    .site-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .header-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav a {
        padding-bottom: 8px;
    }

    .site-nav a::after {
        left: 14px;
        right: 14px;
        bottom: 8px;
    }

    .home-hero-shell,
    .environment-layout,
    .detail-content-grid,
    .info-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-shell {
        flex-direction: column;
    }

    .footer-links {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .site-header {
        padding: 20px 16px 8px;
    }

    .header-shell,
    .dashboard-shell {
        width: min(100%, calc(100% - 24px));
    }

    .header-shell,
    .button-row,
    .command-form {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-card,
    .summary-card,
    .control-card,
    .chart-card,
    .command-card {
        padding: 18px;
    }

    .hero-meta,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .interval-command-inline {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .interval-command-inline input {
        flex: 1 1 120px;
    }

    .command-status-panel,
    .command-log-topline,
    .command-log-meta,
    .device-card-topline,
    .breaker-card-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .breaker-facts {
        grid-template-columns: 1fr;
    }

    .breaker-actions button {
        flex-basis: 100%;
    }

    .waveform-panel {
        height: 300px;
    }

    .home-page .site-header {
        padding: 0;
    }

    .home-nav-shell,
    .home-hero-shell {
        width: 100%;
    }

    .lab-brand {
        gap: 12px;
        max-width: calc(100% - 60px);
    }

    .lab-logo {
        width: 56px;
        height: 56px;
    }

    .lab-brand-cn {
        font-size: 16px;
    }

    .lab-brand-en {
        font-size: 10px;
        letter-spacing: 0.12em;
    }

    .home-hero {
        padding-top: 18px;
    }

    .home-hero-shell {
        min-height: 0;
        padding: 28px 0 22px;
    }

    .home-hero-title {
        font-size: clamp(30px, 9vw, 44px);
    }

    .detail-hero,
    .detail-content-grid {
        width: min(100%, calc(100% - 24px));
    }

    .home-hero-text {
        font-size: 16px;
    }

    .hero-highlight-card,
    .project-card,
    .info-card,
    .news-card,
    .home-device-card {
        padding: 18px;
    }

    .home-section {
        padding: 32px 0;
    }

    .home-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .project-grid,
    .info-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .footer-links {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Detail page: project text, images and demo video */
.detail-text-section,
.detail-media-section,
.detail-video-section {
    width: min(1380px, calc(100% - 40px));
    padding: 0 0 24px;
}

.detail-text-section {
    margin-top: 6px;
}

.detail-feature-card {
    border: 1px solid rgba(111, 204, 234, 0.2);
    border-radius: 28px;
    padding: 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(73, 120, 166, 0.07) 100%),
        rgba(7, 28, 48, 0.72);
    box-shadow: 0 22px 40px rgba(2, 11, 20, 0.28);
    backdrop-filter: blur(12px);
}

.detail-feature-card h2 {
    margin: 8px 0 14px;
    color: #f3fbff;
    font-size: 30px;
    line-height: 1.25;
}

.detail-text-body {
    display: grid;
    gap: 16px;
}

.detail-text-body p,
.detail-media-head p,
.detail-image-card figcaption p {
    color: rgba(216, 233, 245, 0.86);
    font-size: 16px;
    line-height: 1.9;
}

.detail-media-head {
    margin-bottom: 22px;
}

.detail-media-head p:last-child {
    max-width: 960px;
}

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

.detail-image-card {
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(111, 204, 234, 0.18);
    border-radius: 24px;
    background: rgba(4, 18, 31, 0.28);
}

.detail-image-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(circle at 18% 18%, rgba(62, 184, 136, 0.24), transparent 28%),
        radial-gradient(circle at 82% 22%, rgba(38, 130, 255, 0.24), transparent 30%),
        linear-gradient(135deg, rgba(8, 32, 52, 0.98), rgba(10, 50, 78, 0.92));
}

.detail-image-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-image-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: rgba(230, 246, 255, 0.88);
}

.detail-image-placeholder strong {
    font-size: 22px;
    letter-spacing: 0.04em;
}

.detail-image-placeholder span {
    font-size: 14px;
    color: rgba(216, 233, 245, 0.72);
}

.detail-image-card figcaption {
    padding: 18px 20px 22px;
}

.detail-image-card figcaption h3 {
    margin: 0 0 8px;
    color: #f4fbff;
    font-size: 20px;
    line-height: 1.35;
}

.detail-video-section {
    padding-bottom: 80px;
}

.detail-video-card {
    overflow: hidden;
}

.detail-demo-video {
    display: block;
    width: 100%;
    max-height: 680px;
    border-radius: 20px;
    background: #000;
    border: 1px solid rgba(109, 213, 237, 0.18);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

@media (max-width: 960px) {
    .detail-image-grid {
        grid-template-columns: 1fr;
    }

    .detail-text-section,
    .detail-media-section,
    .detail-video-section {
        width: min(100%, calc(100% - 40px));
    }
}

@media (max-width: 640px) {
    .detail-text-section,
    .detail-media-section,
    .detail-video-section {
        width: min(100%, calc(100% - 24px));
    }

    .detail-feature-card {
        padding: 20px;
        border-radius: 22px;
    }

    .detail-feature-card h2 {
        font-size: 24px;
    }

    .detail-image-card figcaption {
        padding: 16px;
    }

    .detail-demo-video {
        border-radius: 16px;
    }
}

/* Detail page image placeholder display control */
.detail-image-wrap.has-image .detail-image-placeholder {
    display: none;
}

.detail-image-wrap.is-missing img {
    display: none;
}

.detail-image-wrap.is-missing .detail-image-placeholder {
    display: grid;
}

.detail-text-section[hidden],
.detail-media-section[hidden],
.detail-video-section[hidden] {
    display: none !important;
}


/* 后台历史数据导出任务 */
.export-dashboard {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.export-dashboard[hidden] {
    display: none;
}

.export-quota-panel,
.export-job-panel,
.export-record-panel {
    border: 1px solid rgba(203, 213, 225, 0.75);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 16px;
}

.export-label {
    display: block;
    color: #627d98;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.export-quota-panel strong,
.export-job-panel strong,
.export-record-panel strong {
    color: #102a43;
    font-size: 16px;
}

.export-job-head,
.export-record-head,
.export-record-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.export-progress {
    height: 10px;
    margin: 14px 0 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.export-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb 0%, #38bdf8 100%);
    transition: width 0.3s ease;
}

.export-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.export-badge[data-variant="neutral"] {
    background: #e2e8f0;
    color: #334e68;
}

.export-badge[data-variant="info"] {
    background: #dbeafe;
    color: #1d4ed8;
}

.export-badge[data-variant="success"] {
    background: #dcfce7;
    color: #047857;
}

.export-badge[data-variant="warning"] {
    background: #fef3c7;
    color: #b45309;
}

.export-badge[data-variant="error"] {
    background: #fee2e2;
    color: #b91c1c;
}

.export-actions {
    margin-top: 12px;
}

.export-download-panel {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed rgba(37, 99, 235, 0.28);
    border-radius: 14px;
    background: rgba(239, 246, 255, 0.68);
}

.export-download-panel[hidden] {
    display: none;
}

.export-download-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.export-download-head strong {
    color: #1d4ed8;
    font-size: 15px;
}

.export-download-progress {
    margin: 4px 0 2px;
}

.export-record-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.export-record-item {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 14px;
    background: #fff;
}

.export-record-item strong {
    font-size: 13px;
    word-break: break-all;
}

/* Event detection card */
.event-detection-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.event-detection-head {
    align-items: flex-start;
    gap: 16px;
}

.event-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    justify-content: flex-end;
}

.event-range-field {
    display: grid;
    gap: 6px;
    color: #52616f;
    font-size: 0.9rem;
}

.event-range-field select {
    min-width: 140px;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    padding: 10px 12px;
    background: #ffffff;
    color: #102a43;
    font: inherit;
}

.event-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.event-stat-panel {
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.event-stat-panel span {
    display: block;
    color: #6b7c8f;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.event-stat-panel strong {
    display: block;
    color: #102a43;
    font-size: 1.2rem;
}

.event-power-panel {
    width: 100%;
    min-height: 420px;
    border: 1px solid #e7edf3;
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
}

.event-detection-message[data-variant="error"] {
    color: #b42318;
}

.event-detection-message[data-variant="warning"] {
    color: #b54708;
}

.event-annotation-panel {
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    padding: 18px;
    background: #f8fbfd;
}

.event-annotation-panel[hidden] {
    display: none;
}

.event-annotation-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.event-algorithm-info {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.event-algorithm-info div {
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #ffffff;
    padding: 12px;
}

.event-algorithm-info span {
    display: block;
    color: #6b7c8f;
    font-size: 0.82rem;
    margin-bottom: 5px;
}

.event-algorithm-info strong {
    display: block;
    color: #102a43;
    font-size: 0.98rem;
    word-break: break-all;
}

.event-annotation-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.event-annotation-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

#event-annotation-note[data-variant="warning"] {
    color: #b54708;
}

#event-annotation-note[data-variant="info"] {
    color: #2563eb;
}

@media (max-width: 1100px) {
    .event-summary-grid,
    .event-algorithm-info {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .event-annotation-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .event-detection-head,
    .event-annotation-head {
        flex-direction: column;
    }

    .event-toolbar {
        justify-content: stretch;
        width: 100%;
    }

    .event-toolbar button,
    .event-range-field,
    .event-range-field select {
        width: 100%;
    }

    .event-summary-grid,
    .event-algorithm-info,
    .event-annotation-form {
        grid-template-columns: 1fr;
    }

    .event-power-panel {
        min-height: 360px;
    }
}

/* Native event detection chart fallback: no external chart library required */
.event-power-panel-native {
    position: relative;
    padding: 10px 12px 14px;
}

.event-power-svg {
    width: 100%;
    min-height: 420px;
    display: block;
}

.event-grid-line {
    stroke: #e7edf3;
    stroke-width: 1;
}

.event-grid-line-vertical {
    stroke-dasharray: 4 6;
    opacity: 0.6;
}

.event-axis-line {
    stroke: #9fb3c8;
    stroke-width: 1.2;
}

.event-axis-label,
.event-axis-title {
    fill: #52616f;
    font-size: 12px;
}

.event-chart-title {
    fill: #102a43;
    font-size: 15px;
    font-weight: 700;
}

.event-power-line {
    fill: none;
    stroke: #2563eb;
    stroke-width: 2.2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.event-event-line {
    stroke-width: 1.6;
    stroke-dasharray: 5 5;
    opacity: 0.82;
}

.event-event-line-on {
    stroke: #dc2626;
}

.event-event-line-off {
    stroke: #16a34a;
}

.event-marker {
    cursor: pointer;
    stroke: #ffffff;
    stroke-width: 2;
    filter: drop-shadow(0 3px 6px rgba(16, 42, 67, 0.22));
}

.event-marker:focus {
    outline: none;
    stroke: #102a43;
    stroke-width: 3;
}

.event-marker-on {
    fill: #dc2626;
}

.event-marker-off {
    fill: #16a34a;
}

.event-marker-label {
    font-size: 12px;
    font-weight: 700;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 3px;
    stroke-linejoin: round;
}

text.event-marker-on {
    fill: #dc2626;
}

text.event-marker-off {
    fill: #16a34a;
}

.event-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    padding: 0 8px 4px 60px;
    color: #52616f;
    font-size: 13px;
}

.event-chart-legend span {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.event-chart-legend i {
    display: inline-block;
    width: 18px;
    height: 4px;
    border-radius: 999px;
}

.legend-line-power {
    background: #2563eb;
}

.legend-on {
    background: #dc2626;
}

.legend-off {
    background: #16a34a;
}

.event-chart-empty {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7c8f;
    text-align: center;
    padding: 24px;
}

@media (max-width: 720px) {
    .event-chart-legend {
        padding-left: 8px;
    }
}

/* Event detection zoom and compact layout refinements */
.event-detection-card {
    gap: 14px;
}

.event-detection-head {
    align-items: center;
}

.event-detection-head h3 {
    margin-bottom: 0;
}

.event-toolbar {
    align-items: center;
}

.event-summary-grid {
    gap: 10px;
}

.event-stat-panel {
    padding: 12px 14px;
}

.event-power-panel {
    min-height: 390px;
}

.event-power-panel-native {
    padding: 8px 10px 10px;
}

.event-power-svg {
    min-height: 390px;
    cursor: crosshair;
    user-select: none;
}

.event-chart-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 6px 2px 54px;
}

.event-chart-actions .event-chart-legend {
    padding: 0;
    flex: 1;
}

.event-chart-tip {
    color: #8a9aae;
    font-size: 12px;
}

.event-reset-zoom-btn {
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
}

.event-zoom-selection {
    fill: rgba(37, 99, 235, 0.16);
    stroke: #2563eb;
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
    pointer-events: none;
}

.event-detection-message {
    margin-top: -4px;
}

.event-annotation-panel {
    padding: 16px;
}

.event-annotation-head {
    margin-bottom: 12px;
}

@media (max-width: 720px) {
    .event-chart-actions {
        padding-left: 6px;
        flex-direction: column;
        align-items: stretch;
    }

    .event-reset-zoom-btn {
        width: 100%;
    }
}
