:root {
    --az-header: #111111;
    --az-sidebar: #f3f2f1;
    --az-sidebar-border: #e1dfdd;
    --az-blue: #0078d4;
    --az-blue-hover: #005a9e;
    --az-text-main: #323130;
    --az-border: #cccccc;
    --az-bg: #faf9f8;
    --az-success: #107c41;
    --az-critical: #e81123;
    --az-warning: #ffb900;
}

* {
    box-sizing: border-box;
    font-family:
        "Segoe UI",
        -apple-system,
        BlinkMacSystemFont,
        Roboto,
        sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f3f2f1;
    color: var(--az-text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    font-size: 13px;
}

.az-header {
    background-color: var(--az-header);
    color: white;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.az-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 14px;
}

/* Main Workspace Layout */
.az-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Navigation Sidebar */
.az-sidebar {
    width: 230px;
    background-color: var(--az-sidebar);
    border-right: 1px solid var(--az-sidebar-border);
    display: flex;
    flex-direction: column;
    padding-top: 10px;
    overflow-y: auto;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--az-sidebar-border);
    padding: 12px 0;
}

.traffic-radio-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 16px;
}

.traffic-radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 0;
    cursor: pointer;
    color: #323130;
}

.traffic-radio-option input[type="radio"] {
    cursor: pointer;
}

.sidebar-toggle-row {
    padding: 10px 16px 0;
}

.sidebar-title {
    padding: 8px 16px;
    font-weight: 700;
    color: #605e5c;
    font-size: 11px;
    text-transform: uppercase;
}

.sidebar-item {
    padding: 10px 16px;
    color: #323130;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-item:hover {
    background-color: #eaeaea;
}

.sidebar-item.active {
    background-color: #edebe9;
    color: var(--az-blue);
    font-weight: 600;
    border-left: 3px solid var(--az-blue);
}

.az-blade {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    overflow-y: auto;
}

.blade-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e1dfdd;
    background-color: #fff;
}

.breadcrumbs {
    font-size: 11px;
    color: #605e5c;
    margin-bottom: 4px;
}

.blade-header h1 {
    font-size: 18px;
    font-weight: 400;
    color: #252423;
}

.az-command-bar {
    background-color: #fff;
    border-bottom: 1px solid #e1dfdd;
    padding: 6px 24px;
    display: flex;
    gap: 15px;
}

.command-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #323130;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
}

.command-btn:hover {
    background-color: #f3f2f1;
}

.blade-content {
    padding: 24px;
    flex: 1;
}

.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
}

.wizard-steps {
    display: flex;
    border-bottom: 1px solid var(--az-border);
    margin-bottom: 20px;
    background: #faf9f8;
}

.w-step {
    padding: 10px 20px;
    color: #605e5c;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    cursor: pointer;
}

.w-step:hover {
    color: var(--az-blue);
}

.w-step.active {
    color: var(--az-blue);
    border-bottom-color: var(--az-blue);
    font-weight: 600;
}

.wizard-content-box {
    border: 1px solid var(--az-border);
    background: #fff;
    padding: 20px;
    min-height: 250px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 16px;
    max-width: 500px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    font-size: 12px;
    outline: none;
}

.form-group select:focus,
.form-group input:focus {
    border-color: var(--az-blue);
}

.metric-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.metric-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.metric-row select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    font-size: 12px;
}

.metric-row-remove {
    background: none;
    border: none;
    color: #a19f9d;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
}

.metric-row-remove:hover {
    color: var(--az-critical);
}

.btn-link {
    background: none;
    border: none;
    color: var(--az-blue);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 0;
    margin-top: 4px;
}

.btn-link:hover {
    text-decoration: underline;
}

.chart-type-toggle {
    display: flex;
    gap: 6px;
}

.chart-type-btn {
    flex: 1;
    padding: 6px 4px;
    font-size: 11px;
    border: 1px solid #c8c6c4;
    background: #fff;
    cursor: pointer;
    border-radius: 2px;
}

.chart-type-btn:hover {
    border-color: var(--az-blue);
}

.chart-type-btn.active {
    border-color: var(--az-blue);
    background: #f3f9fd;
    color: var(--az-blue);
    font-weight: 600;
}

.pin-icon-btn {
    background: #fff;
    border: 1px solid #c8c6c4;
    border-radius: 2px;
    padding: 5px 12px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
    color: #323130;
}

.pin-icon-btn:hover {
    border-color: var(--az-blue);
    color: var(--az-blue);
    background: #f3f9fd;
}

.metric-chips {
    margin-top: 10px;
}

.metric-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-chip {
    position: relative; /* anchors the alert badge's popover */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--chip-color);
    background: color-mix(in srgb, var(--chip-color) 12%, white);
    border: 1px solid color-mix(in srgb, var(--chip-color) 45%, white);
    white-space: nowrap;
}

.metric-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chip-color);
    flex-shrink: 0;
}

/* Reserves room for the widest possible reading ("100.0%" / "> 100%") so the
   chip's width stays put as the live value crosses a digit boundary (9% -> 10%). */
.metric-chip-num {
    display: inline-block;
    min-width: 6ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Bell badge on a metric's own chip — only rendered when that metric has alerts.
   Hovering it reveals the popover below listing that metric's rules and thresholds. */
.metric-chip-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 2px;
    padding: 1px 5px;
    border: none;
    border-radius: 8px;
    background: color-mix(in srgb, var(--chip-color) 28%, white);
    color: var(--chip-color);
    font-size: 9px;
    line-height: 1.5;
    cursor: default;
}

.metric-chip-badge:hover {
    background: color-mix(in srgb, var(--chip-color) 42%, white);
}

.metric-chip-badge-count {
    font-weight: 700;
}

.metric-chip-popover {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    min-width: 170px;
    padding: 6px 0;
    border-radius: 8px;
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--chip-color) 45%, white);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    z-index: 20;
    white-space: normal;
}

.metric-chip-badge:hover + .metric-chip-popover {
    display: block;
}

.metric-chip-popover-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: #323130;
    white-space: nowrap;
}

.metric-chip-popover-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chip-color);
    flex-shrink: 0;
}

.alerts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.alerts-table th,
.alerts-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #f3f2f1;
}

.alerts-table th {
    color: #605e5c;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
}

.alerts-row-actions {
    display: flex;
    gap: 6px;
}

.alerts-row-actions .btn {
    padding: 4px 10px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.autoscale-rules-table select,
.autoscale-rules-table input {
    padding: 4px 6px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    font-size: 12px;
}

/* Cards and Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.card {
    border: 1px solid #d2d0ce;
    background: white;
    padding: 16px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 10px;
    vertical-align: middle;
}

.status-pill.running {
    color: var(--az-success);
    background: #e6f4ea;
}

.status-pill.degraded {
    color: #8a6d00;
    background: #fff4ce;
}

.status-pill.down {
    color: var(--az-critical);
    background: #fde7e9;
}

.status-pill.restarting {
    color: var(--az-blue);
    background: #c7e0f4;
}

.status-pill.off {
    color: #605e5c;
    background: #edebe9;
}

.kv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
}

.kv-table td {
    padding: 7px 0;
    border-bottom: 1px solid #f3f2f1;
}

.kv-table td:first-child {
    color: #605e5c;
    width: 45%;
}

.stat-tiles {
    display: flex;
    gap: 12px;
}

.stat-tile {
    flex: 1;
    background: #faf9f8;
    border: 1px solid #e1dfdd;
    border-radius: 4px;
    padding: 12px;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #252423;
}

.stat-label {
    font-size: 11px;
    color: #605e5c;
    margin-top: 4px;
}

.size-options {
    display: flex;
    gap: 12px;
}

.size-option {
    flex: 1;
    border: 2px solid #e1dfdd;
    border-radius: 4px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: 0.15s;
}

.size-option:hover {
    border-color: #c8c6c4;
}

.size-option.active {
    border-color: var(--az-blue);
    background: #f3f9fd;
}

.size-option.resizing {
    opacity: 0.5;
    pointer-events: none;
}

.size-option h4 {
    font-size: 13px;
    margin-bottom: 6px;
}

.size-spec {
    font-size: 11px;
    color: #605e5c;
}

.size-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.size-table th,
.size-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #f3f2f1;
}

.size-table th {
    color: #605e5c;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
}

.size-row {
    cursor: pointer;
}

.size-row:hover td {
    background: #faf9f8;
}

.size-row.current td {
    font-weight: 600;
}

.size-row.pending td {
    background: #fffbea;
}

.browser-mock {
    border: 1px solid #d2d0ce;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: 0.2s;
}

.browser-mock.offline {
    border: 2px solid var(--az-critical);
    box-shadow: 0 0 0 3px rgba(232, 17, 35, 0.12);
}

.browser-mock.maintenance {
    border: 2px solid var(--az-blue);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.12);
}

.browser-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f3f2f1;
    padding: 8px 12px;
    border-bottom: 1px solid #e1dfdd;
}

.browser-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #d2d0ce;
    display: inline-block;
}

.browser-url {
    margin-left: 8px;
    background: #fff;
    border: 1px solid #e1dfdd;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 11px;
    color: #605e5c;
    flex: 1;
}

.browser-content {
    padding: 30px 20px;
    text-align: center;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.browser-home h4 {
    font-size: 16px;
    margin-bottom: 6px;
    color: #252423;
}

.browser-home p {
    font-size: 12px;
    color: #605e5c;
}

.browser-error-code {
    font-size: 34px;
    font-weight: 700;
    color: var(--az-critical);
    line-height: 1;
}

.browser-error-title {
    font-size: 14px;
    font-weight: 600;
    margin: 6px 0 10px;
    color: var(--az-critical);
}

.browser-error p {
    font-size: 12px;
    color: #605e5c;
    max-width: 380px;
}

.outage-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: #fdf2f3;
    border-bottom: 1px solid var(--az-critical);
    border-left: 4px solid var(--az-critical);
    color: #7a0d17;
    padding: 10px 24px;
    font-size: 12.5px;
    line-height: 1.5;
}

.outage-icon {
    font-size: 16px;
}

.maintenance-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: #eff6fc;
    border-bottom: 1px solid var(--az-blue);
    border-left: 4px solid var(--az-blue);
    color: #004578;
    padding: 10px 24px;
    font-size: 12.5px;
    line-height: 1.5;
}

.chart-frame.overloaded {
    border-color: var(--az-critical);
    box-shadow: 0 0 0 3px rgba(232, 17, 35, 0.12);
}

.card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
}

.btn {
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #8a8886;
    background: white;
    border-radius: 2px;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--az-blue);
    color: white;
    border-color: var(--az-blue);
}

.btn-primary:hover {
    background-color: var(--az-blue-hover);
}

.mode-btn {
    flex: 1;
    padding: 12px;
    text-align: center;
    border: 2px solid transparent;
    background: #f3f2f1;
    color: #323130;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}

.mode-btn h4 {
    margin-bottom: 4px;
    font-size: 14px;
}

.mode-btn p {
    font-size: 11px;
    font-weight: normal;
    color: #605e5c;
}

.chart-frame {
    background: #faf9f8;
    border: 1px solid #e1dfdd;
    padding: 8px;
    position: relative;
}

canvas {
    width: 100%;
    height: 160px;
    display: block;
}

.channels-display {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.channel-node {
    flex: 1;
    padding: 10px;
    border: 1px solid #d2d0ce;
    text-align: center;
    background: #f3f2f1;
    font-weight: 600;
    color: #a19f9d;
    border-radius: 2px;
    transition: 0.3s;
}

.channel-node.active-fired {
    background-color: #fde7e9;
    border-color: var(--az-critical);
    color: var(--az-critical);
    box-shadow: 0 0 8px rgba(232, 17, 35, 0.3);
}

.badge {
    background: #edebe9;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

.badge.blue {
    background: #c7e0f4;
    color: var(--az-blue);
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-left: 4px solid var(--az-blue);
    padding: 10px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--az-text-main);
    max-width: 250px;
    max-height: 64px;
    box-sizing: border-box;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.toast.toast-error {
    border-left-color: var(--az-critical);
}

.toast-message {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: 0.5s ease-in;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}
