:root {
    color-scheme: light;
    --hubr-bg: #f3f6f8;
    --hubr-panel: #ffffff;
    --hubr-text: #1d2430;
    --hubr-muted: #687386;
    --hubr-line: #d8dee8;
    --hubr-accent: #1b7f6b;
    --hubr-accent-dark: #126352;
    --hubr-accent-soft: #e5f4f0;
    --hubr-danger: #b42318;
}

body {
    min-height: 100vh;
    background: linear-gradient(180deg, #ffffff 0, var(--hubr-bg) 260px);
    color: var(--hubr-text);
}

.text-muted,
.form-text,
.card-text,
.small,
small {
    color: var(--hubr-muted) !important;
}

.btn-primary {
    --bs-btn-bg: var(--hubr-accent);
    --bs-btn-border-color: var(--hubr-accent);
    --bs-btn-hover-bg: var(--hubr-accent-dark);
    --bs-btn-hover-border-color: var(--hubr-accent-dark);
    --bs-btn-active-bg: var(--hubr-accent-dark);
    --bs-btn-active-border-color: var(--hubr-accent-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--hubr-accent);
    --bs-btn-border-color: var(--hubr-accent);
    --bs-btn-hover-bg: var(--hubr-accent);
    --bs-btn-hover-border-color: var(--hubr-accent);
    --bs-btn-active-bg: var(--hubr-accent-dark);
    --bs-btn-active-border-color: var(--hubr-accent-dark);
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--hubr-accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.app-shell {
    width: min(1160px, 100%);
}

.monitor-shell {
    width: min(1500px, calc(100% - 2rem));
    margin: 0 auto;
    padding-bottom: 2rem;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.monitor-topbar {
    min-height: 64px;
}

.comba-logo {
    color: #23aee6;
    font-size: clamp(2.4rem, 5vw, 4.6rem);
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
}

.comba-logo:hover {
    color: #1d9fd4;
}

.top-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(1rem, 3vw, 2.8rem);
    color: #07184b;
    font-size: 1.05rem;
    font-weight: 800;
}

.top-menu a,
.top-menu button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: none;
}

.top-menu a:hover,
.top-menu button:hover,
.top-menu .active {
    color: var(--hubr-accent);
}

.monitor-title {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0 0.55rem;
    color: #09286d;
    text-align: center;
}

.monitor-title h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1.12;
}

.monitor-title mark {
    display: inline-block;
    padding: 0 0.25rem;
    background: #98ff19;
    color: #09286d;
}

.monitor-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 auto 1rem;
    width: min(100%, 1400px);
}

.export-actions {
    display: inline-flex;
    overflow: hidden;
    border-radius: 999px;
    background: #707982;
}

.export-actions button {
    padding: 0.15rem 0.75rem;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 1.3rem;
    line-height: 1.2;
}

.export-actions button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.search-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #07184b;
    font-size: 1.05rem;
}

.search-field input {
    width: min(250px, 48vw);
    height: 2.6rem;
    border: 1px solid #b8b8b8;
    border-radius: 0.2rem;
    padding: 0.35rem 0.55rem;
}

.monitor-table-wrap {
    width: min(100%, 1400px);
    margin: 0 auto;
    overflow: visible;
}

.monitor-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: #07184b;
    font-size: 1.1rem;
}

.monitor-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid #222222;
    background: #ffffff;
}

.monitor-table thead th {
    background: #ffffff;
    box-shadow: 0 1px 0 #222222;
}

.monitor-table th,
.monitor-table td {
    padding: 0.58rem 0.75rem;
    vertical-align: middle;
}

.monitor-table th {
    font-weight: 900;
}

.monitor-table tbody tr:nth-child(odd) {
    background: #f6f6f6;
}

.monitor-table .number-col {
    width: 8.5rem;
}

.sort-button {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 900;
}

.sort-button::after {
    content: " \2195";
    color: #c9c9c9;
    font-weight: 400;
}

.sort-button.active::after {
    content: " \2191";
    color: #6e7fe2;
}

.equipment-icon {
    color: #111111;
    font-size: 0.85rem;
}

.external-link {
    color: #000000;
    font-size: 0.95rem;
    text-decoration: none;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-width: 7.5rem;
    color: var(--hubr-accent-dark);
    font-weight: 800;
}

.status-online {
    color: var(--hubr-accent-dark);
}

.status-alarm {
    color: #b54708;
}

.status-offline {
    color: var(--hubr-danger);
}

.status-pending,
.status-unsupported,
.status-disabled {
    color: var(--hubr-muted);
}

.disabled-equipment .status-pill,
.disabled-equipment .equipment-name {
    color: var(--hubr-muted);
}

.status-detail,
.analysis-detail {
    display: block;
    margin-top: 0.15rem;
    color: var(--hubr-muted);
    font-size: 0.82rem;
    line-height: 1.2;
}

.analysis-cell {
    max-width: 34rem;
}

.analysis-pill {
    min-width: 6rem;
}

.analysis-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    word-break: normal;
}

.analysis-alarm-item {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.4rem;
    border: 1px solid #f0b37e;
    border-radius: 0.25rem;
    background: #fff7ed;
    color: #8a3b12;
    line-height: 1.2;
}

.analysis-alarm-item strong {
    font-weight: 800;
}

.analysis-alarm-item .badge {
    flex: 0 0 auto;
    border-radius: 0.25rem;
    font-size: 0.72rem;
}

.monitor-message {
    width: min(100%, 1400px);
    margin: 0.75rem auto 0;
}

.monitor-config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.monitor-config-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 5.5rem;
    padding: 0.8rem;
    border: 1px solid var(--hubr-line);
    border-radius: 0.5rem;
    background: #ffffff;
}

.monitor-config-control strong,
.monitor-config-control small {
    display: block;
}

.monitor-config-control small {
    margin-top: 0.25rem;
    color: var(--hubr-muted);
    line-height: 1.25;
}

.monitor-config-control .form-check-input {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 1.35rem;
    margin: 0;
}

.monitor-config-control .form-select {
    flex: 0 0 6.5rem;
}

@media (max-width: 900px) {
    .monitor-table-wrap {
        overflow-x: auto;
    }

    .monitor-config-grid {
        grid-template-columns: 1fr;
    }
}

.login-screen {
    min-height: 100vh;
}

.login-panel {
    width: min(100%, 410px);
}

.admin-nav {
    overflow-x: auto;
    scrollbar-width: thin;
}

.admin-nav .nav-link {
    min-width: max-content;
    color: var(--hubr-muted);
    font-weight: 800;
}

.admin-nav .nav-link:hover {
    color: var(--hubr-text);
    background: #f1f5f8;
}

.admin-nav .nav-link.active {
    background: var(--hubr-accent);
    color: #ffffff;
}

.shortcut-card,
.info-card,
.content-panel,
.editor-pane {
    border-color: var(--hubr-line);
    box-shadow: 0 10px 28px rgba(26, 35, 52, 0.05);
}

.shortcut-card {
    min-height: 142px;
    color: var(--hubr-text);
    text-decoration: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.shortcut-card:hover {
    border-color: var(--hubr-accent);
    box-shadow: 0 12px 30px rgba(26, 35, 52, 0.1);
    color: var(--hubr-text);
    transform: translateY(-1px);
}

.shortcut-icon {
    display: inline-flex;
    width: 2.8rem;
    height: 2.8rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: var(--hubr-accent-soft);
    color: var(--hubr-accent-dark);
    font-size: 1rem;
}

.field-label {
    color: var(--hubr-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.info-card strong,
.shortcut-card strong,
.sms-meta strong,
.sms-meta span,
.sms-item p,
.pane-title span {
    overflow-wrap: anywhere;
}

.signal-meter {
    width: 100%;
    height: 0.75rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e7edf3;
}

.signal-meter span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--hubr-accent);
    transition: width 0.2s ease;
}

.raw-response {
    min-height: 110px;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

textarea.form-control {
    min-height: 360px;
    resize: vertical;
    font-family: "Courier New", monospace;
    font-size: 0.84rem;
    line-height: 1.45;
}

.json-tree-editor {
    height: min(68vh, 760px);
    min-height: 520px;
}

.json-tree-editor div.jsoneditor {
    border-color: var(--hubr-line);
}

.json-tree-editor div.jsoneditor-menu {
    background: var(--hubr-accent);
    border-bottom-color: var(--hubr-accent-dark);
}

.json-editor-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--hubr-muted);
    font-size: 0.82rem;
}

.json-editor-status .ok {
    color: var(--hubr-accent-dark);
}

.json-editor-status .error {
    color: var(--hubr-danger);
}

textarea.sms-compose-text {
    min-height: 112px;
    font-family: inherit;
    font-size: 1rem;
}

.message {
    min-height: 1.25rem;
    margin: 0;
    color: var(--hubr-muted);
    font-size: 0.875rem;
}

.message.error {
    color: var(--hubr-danger);
}

.message.ok {
    color: var(--hubr-accent-dark);
}

@media (max-width: 767.98px) {
    body {
        background: var(--hubr-bg);
    }

    .monitor-shell {
        width: min(100%, calc(100% - 1rem));
    }

    .topbar,
    .monitor-tools {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-menu {
        width: 100%;
        justify-content: space-between;
        gap: 0.8rem;
        font-size: 1rem;
    }

    .monitor-title {
        justify-content: flex-start;
        text-align: left;
    }

    .monitor-table {
        min-width: 760px;
    }

    .admin-nav {
        margin-right: -0.75rem;
        margin-left: -0.75rem;
        padding-right: 0.75rem !important;
        padding-left: 0.75rem !important;
        border-right: 0 !important;
        border-left: 0 !important;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .shortcut-card {
        min-height: 0;
    }

    textarea.form-control {
        min-height: 260px;
    }

    .json-tree-editor {
        min-height: 420px;
    }

    textarea.sms-compose-text {
        min-height: 112px;
    }
}
