
:root {
    --sem-blue: #0c63e7;
    --sem-blue-dark: #0b2f67;
    --sem-bg: #f4f7fb;
    --sem-card: #ffffff;
    --sem-text: #17233c;
    --sem-muted: #6f7b91;
    --sem-border: #dfe7f1;
    --sem-l1: #25b747;
    --sem-l2: #ed3340;
    --sem-l3: #ffa21f;
}

body.sem-dashboard-page {
    margin: 0 !important;
    background: var(--sem-bg) !important;
}

body.sem-dashboard-page .site-header,
body.sem-dashboard-page header.wp-block-template-part,
body.sem-dashboard-page .wp-site-blocks > header,
body.sem-dashboard-page .site-footer,
body.sem-dashboard-page footer.wp-block-template-part,
body.sem-dashboard-page .wp-site-blocks > footer,
body.sem-dashboard-page .entry-header,
body.sem-dashboard-page .wp-block-post-title {
    display: none !important;
}

body.sem-dashboard-page main,
body.sem-dashboard-page .site-main,
body.sem-dashboard-page .entry-content,
body.sem-dashboard-page .wp-block-post-content,
body.sem-dashboard-page .wp-site-blocks {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sem-app,
.sem-app * {
    box-sizing: border-box;
}

.sem-app {
    width: 100%;
    min-height: 100vh;
    background: var(--sem-bg);
    color: var(--sem-text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-variant-numeric: tabular-nums;
}

.sem-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid var(--sem-border);
    backdrop-filter: blur(16px);
}

.admin-bar .sem-header {
    top: 32px;
}

.sem-header-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 28px;
    width: 100%;
    max-width: 1880px;
    min-height: 76px;
    margin: 0 auto;
    padding: 0 clamp(24px, 3vw, 64px);
}

.sem-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    min-width: 250px;
}

.sem-brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--sem-blue), #2d7cff);
    color: white;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(12, 99, 231, .2);
}

.sem-brand-text strong,
.sem-brand-text small {
    display: block;
}

.sem-brand-text strong {
    font-size: 15px;
    line-height: 1.2;
}

.sem-brand-text small {
    margin-top: 4px;
    color: var(--sem-muted);
    font-size: 11px;
}

.sem-desktop-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.sem-desktop-nav a {
    position: relative;
    padding: 29px 0 24px;
    color: #445169;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.sem-desktop-nav a:hover,
.sem-desktop-nav a.is-active {
    color: var(--sem-blue);
}

.sem-desktop-nav a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--sem-blue);
}

.sem-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sem-header-time small,
.sem-header-time strong {
    display: block;
    text-align: right;
}

.sem-header-time small {
    color: var(--sem-muted);
    font-size: 10px;
}

.sem-header-time strong {
    margin-top: 4px;
    font-size: 15px;
}

.sem-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 11px;
    border: 1px solid var(--sem-border);
    border-radius: 11px;
    background: white;
}

.sem-menu-toggle span {
    display: block;
    height: 2px;
    margin: 4px 0;
    border-radius: 2px;
    background: var(--sem-text);
}

.sem-shell {
    width: 100%;
    max-width: 1880px;
    margin: 0 auto;
    padding: clamp(24px, 2.6vw, 48px) clamp(24px, 3vw, 64px) 64px;
}

.sem-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(640px, .95fr);
    align-items: center;
    gap: 36px;
    margin-bottom: 22px;
}

.sem-eyebrow {
    margin: 0 0 8px;
    color: var(--sem-blue);
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .14em;
}

.sem-overview h1 {
    margin: 0;
    font-size: clamp(34px, 3.2vw, 56px);
    line-height: 1.02;
    letter-spacing: -.04em;
}

.sem-subtitle {
    max-width: 760px;
    margin: 16px 0 0;
    color: var(--sem-muted);
    font-size: 15px;
    line-height: 1.65;
}

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

.sem-status-card {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 78px;
    padding: 14px;
    border: 1px solid var(--sem-border);
    border-radius: 14px;
    background: var(--sem-card);
    box-shadow: 0 8px 24px rgba(18, 42, 76, .04);
}

.sem-status-indicator {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #f2b63a;
}

.sem-status-card.is-online .sem-status-indicator {
    background: #2bc64c;
}

.sem-status-card.is-offline .sem-status-indicator {
    background: #ef4753;
}

.sem-status-card small,
.sem-status-card strong,
.sem-status-card em {
    display: block;
}

.sem-status-card small {
    color: var(--sem-muted);
    font-size: 10px;
}

.sem-status-card strong {
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.15;
    white-space: nowrap;
}

.sem-status-card em {
    margin-top: 3px;
    color: var(--sem-muted);
    font-size: 10px;
    font-style: normal;
}

.sem-wifi-symbol {
    color: var(--sem-blue);
    font-size: 26px;
    line-height: 1;
}

.sem-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.sem-kpi-card,
.sem-phase-card,
.sem-panel {
    border: 1px solid var(--sem-border);
    border-radius: 16px;
    background: var(--sem-card);
    box-shadow: 0 10px 28px rgba(18, 42, 76, .045);
}

.sem-kpi-card {
    min-height: 132px;
    padding: 22px;
}

.sem-kpi-card > span {
    display: block;
    min-height: 28px;
    color: var(--sem-muted);
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;
}

.sem-kpi-card strong {
    display: block;
    margin-top: 18px;
    font-size: clamp(27px, 2.3vw, 40px);
    line-height: 1;
    letter-spacing: -.03em;
}

.sem-kpi-card small {
    color: var(--sem-muted);
    font-size: .44em;
    font-weight: 600;
}

.sem-section {
    margin-top: 8px;
}

.sem-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.sem-section-header.compact {
    margin-bottom: 14px;
}

.sem-section-header h2 {
    margin: 0;
    font-size: 25px;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.sem-section-header > p {
    margin: 0;
    color: var(--sem-muted);
    font-size: 12px;
}

.sem-phase-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.sem-phase-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 22px;
}

.sem-phase-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--phase);
}

.sem-l1 { --phase: var(--sem-l1); }
.sem-l2 { --phase: var(--sem-l2); }
.sem-l3 { --phase: var(--sem-l3); }

.sem-phase-top,
.sem-phase-name {
    display: flex;
    align-items: center;
}

.sem-phase-top {
    justify-content: space-between;
    gap: 12px;
}

.sem-phase-name {
    gap: 10px;
}

.sem-phase-badge {
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 36px;
    padding: 0 11px;
    border-radius: 9px;
    background: var(--phase);
    color: white;
    font-size: 14px;
    font-weight: 800;
}

.sem-phase-state {
    padding: 6px 9px;
    border: 1px solid #cfe8d5;
    border-radius: 999px;
    background: #f0fbf3;
    color: #168432;
    font-size: 10px;
    font-weight: 800;
}

.sem-phase-state.is-offline {
    border-color: #ffd4d8;
    background: #fff3f4;
    color: #c52a35;
}

.sem-phase-main-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.sem-phase-main-values > div {
    min-width: 0;
    padding: 17px;
    border-radius: 13px;
    background: #f7f9fc;
}

.sem-phase-main-values span {
    display: block;
    color: var(--sem-muted);
    font-size: 11px;
}

.sem-phase-main-values strong {
    display: block;
    margin-top: 9px;
    font-size: clamp(27px, 2.3vw, 38px);
    line-height: 1;
    letter-spacing: -.03em;
}

.sem-phase-main-values small {
    color: var(--sem-muted);
    font-size: .47em;
}

.sem-phase-metrics {
    margin: 0;
}

.sem-phase-metrics div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 0;
    border-top: 1px solid #edf1f6;
}

.sem-phase-metrics dt {
    color: var(--sem-muted);
    font-size: 12px;
}

.sem-phase-metrics dd {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.sem-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, .6fr);
    gap: 16px;
    margin-top: 16px;
}

.sem-panel {
    padding: 22px;
}

.sem-device-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.sem-device-grid > div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--sem-border);
    border-radius: 11px;
}

.sem-device-grid span {
    color: var(--sem-muted);
    font-size: 12px;
}

.sem-device-grid strong {
    font-size: 12px;
    text-align: right;
}

.sem-relay-list {
    display: grid;
    gap: 10px;
}

.sem-relay {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-radius: 11px;
    background: #f5f7fa;
}

.sem-relay.is-on {
    background: #eefaf1;
}

.sem-relay.is-on strong {
    color: #158333;
}

.sem-relay.is-off strong {
    color: #7b8495;
}

.sem-error {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #ffd2d6;
    border-radius: 11px;
    background: #fff2f3;
    color: #a92530;
    font-size: 13px;
    font-weight: 700;
}

.sem-drawer,
.sem-overlay {
    display: none;
}

@media (min-width: 1500px) {
    .sem-shell {
        padding-left: 72px;
        padding-right: 72px;
    }

    .sem-kpi-card {
        min-height: 142px;
    }

    .sem-phase-card {
        padding: 24px;
    }
}

@media (max-width: 1280px) {
    .sem-overview {
        grid-template-columns: 1fr;
    }

    .sem-status-panel {
        max-width: 980px;
    }

    .sem-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sem-kpi-card:nth-child(4),
    .sem-kpi-card:nth-child(5) {
        grid-column: span 1;
    }

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

@media (max-width: 980px) {
    .admin-bar .sem-header {
        top: 46px;
    }

    .sem-header-inner {
        grid-template-columns: 1fr auto;
        min-height: 68px;
        padding: 0 18px;
    }

    .sem-desktop-nav {
        display: none;
    }

    .sem-header-time {
        display: none;
    }

    .sem-menu-toggle {
        display: block;
    }

    .sem-drawer {
        position: fixed;
        z-index: 100;
        inset: 0 auto 0 0;
        display: block;
        width: min(340px, 86vw);
        padding: 20px;
        border-right: 1px solid var(--sem-border);
        background: white;
        transform: translateX(-105%);
        transition: transform .22s ease;
    }

    .sem-drawer.is-open {
        transform: translateX(0);
    }

    .sem-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding-bottom: 18px;
        border-bottom: 1px solid var(--sem-border);
    }

    .sem-drawer-header button {
        border: 0;
        background: transparent;
        font-size: 30px;
        line-height: 1;
    }

    .sem-drawer nav {
        display: grid;
        gap: 6px;
        margin-top: 18px;
    }

    .sem-drawer a {
        padding: 14px;
        border-radius: 10px;
        color: var(--sem-text);
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
    }

    .sem-drawer a.is-active {
        background: var(--sem-blue);
        color: white;
    }

    .sem-overlay {
        position: fixed;
        z-index: 90;
        inset: 0;
        display: block;
        background: rgba(8, 23, 49, .45);
    }

    .sem-shell {
        padding: 22px 18px 48px;
    }

    .sem-phase-grid,
    .sem-lower-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .sem-brand {
        min-width: 0;
    }

    .sem-brand-text small {
        display: none;
    }

    .sem-overview {
        gap: 22px;
    }

    .sem-overview h1 {
        font-size: 34px;
    }

    .sem-subtitle {
        font-size: 14px;
    }

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

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

    .sem-kpi-card:nth-child(5) {
        grid-column: 1 / -1;
    }

    .sem-section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .sem-device-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .sem-header-inner {
        padding: 0 12px;
    }

    .sem-shell {
        padding: 16px 12px 36px;
    }

    .sem-brand-mark {
        width: 42px;
        height: 42px;
    }

    .sem-brand-text strong {
        font-size: 14px;
    }

    .sem-overview h1 {
        font-size: 29px;
        line-height: 1.08;
    }

    .sem-status-panel,
    .sem-kpi-grid,
    .sem-phase-main-values {
        grid-template-columns: 1fr;
    }

    .sem-kpi-card:nth-child(5) {
        grid-column: auto;
    }

    .sem-status-card {
        min-height: 68px;
    }

    .sem-kpi-card {
        min-height: 112px;
        padding: 18px;
    }

    .sem-phase-card {
        padding: 18px;
    }

    .sem-phase-top {
        align-items: flex-start;
    }

    .sem-phase-main-values strong {
        font-size: 32px;
    }

    .sem-phase-metrics div {
        align-items: flex-start;
    }

    .sem-phase-metrics dt,
    .sem-phase-metrics dd {
        font-size: 12px;
    }
}
