:root {
    --alert-ink: #16324f;
    --alert-muted: #667085;
    --alert-border: #dfe5ec;
    --alert-soft: #f5f8fb;
    --alert-accent: #168acd;
}

body {
    background: #f4f6f9;
    color: var(--alert-ink);
}

.alert-page {
    max-width: 1500px;
}

.alert-hero {
    background:
        radial-gradient(circle at top right, rgba(29, 161, 242, 0.22), transparent 35%),
        linear-gradient(135deg, #102a43, #174f72);
    color: #fff;
    border-radius: 18px;
    padding: 1.5rem;
}

.alert-hero p {
    color: rgba(255, 255, 255, 0.78);
}

.summary-card,
.config-card {
    border: 1px solid var(--alert-border);
    border-radius: 14px;
    box-shadow: 0 7px 20px rgba(16, 42, 67, 0.05);
}

.summary-card strong {
    display: block;
    font-size: 1.65rem;
}

.summary-card span {
    color: var(--alert-muted);
    font-size: 0.85rem;
}

.nav-tabs .nav-link {
    color: var(--alert-muted);
    font-weight: 600;
}

.nav-tabs .nav-link.active {
    color: var(--alert-accent);
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.field-help {
    color: var(--alert-muted);
    font-size: 0.78rem;
}

.rule-type-note {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    background: linear-gradient(135deg, #f2f8fc, #f8fafc);
    border: 1px solid #d8e9f4;
    border-left: 4px solid var(--alert-accent);
    border-radius: 10px;
    padding: 0.85rem;
}

.rule-type-note__icon {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    border-radius: 10px;
    color: #fff;
    background: var(--alert-accent);
    font-size: 1.05rem;
    box-shadow: 0 5px 12px rgba(22, 138, 205, 0.2);
}

.rule-type-note__content {
    min-width: 0;
    flex: 1;
}

.rule-type-note__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 0.7rem;
    color: #17324d;
}

.rule-type-note__description {
    display: block;
    margin-top: 0.25rem;
    color: var(--alert-muted);
    line-height: 1.45;
}

.rule-trigger-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid #b9dced;
    border-radius: 999px;
    color: #116a9c;
    background: #e8f4fb;
    font-size: 0.67rem;
    font-weight: 700;
    white-space: nowrap;
}

.template-editor {
    min-height: 190px;
    line-height: 1.55;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
}

.template-variable-label {
    display: block;
    margin-bottom: 0.4rem;
    color: #475467;
    font-weight: 600;
}

.template-variable-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.template-variable-list code {
    display: inline-flex;
    padding: 0.18rem 0.4rem;
    border: 1px solid #e3d6fb;
    border-radius: 6px;
    color: #7c3aed;
    background: #f7f2ff;
    font-size: 0.72rem;
}

#ruleForm .row > [class*="col-"] {
    min-width: 0;
}

#ruleForm .form-control,
#ruleForm .form-select,
#ruleForm .input-group-text {
    min-height: 38px;
}

#ruleForm .form-control:focus,
#ruleForm .form-select:focus {
    border-color: #64b5e2;
    box-shadow: 0 0 0 0.2rem rgba(22, 138, 205, 0.13);
}

#ruleAlertType {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table td,
.table th {
    vertical-align: middle;
}

.message-preview {
    white-space: pre-wrap;
    max-width: 520px;
    max-height: 150px;
    overflow: auto;
    font-size: 0.8rem;
}

.status-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    margin-right: 0.35rem;
}

.status-dot.on {
    background: #198754;
}

.status-dot.off {
    background: #adb5bd;
}

.sticky-form {
    position: sticky;
    top: 1rem;
}

.guide-shell {
    overflow: hidden;
}

.guide-time {
    align-self: flex-start;
    background: #e8f4fb;
    color: #116a9c;
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.guide-step {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    gap: 1rem;
    position: relative;
    padding-bottom: 2rem;
    margin-bottom: 0.25rem;
}

.guide-step:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 2.75rem;
    bottom: 0;
    left: 1.35rem;
    width: 2px;
    background: #d8e8f2;
}

.guide-step-number {
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    background: var(--alert-accent);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    box-shadow: 0 0 0 5px #e8f4fb;
    z-index: 1;
}

.guide-step-content {
    min-width: 0;
    padding-top: 0.35rem;
}

.guide-step-content ol {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.guide-step-content li {
    margin-bottom: 0.55rem;
    line-height: 1.55;
}

.guide-example,
.guide-code {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    background: var(--alert-soft);
    border: 1px solid var(--alert-border);
    border-radius: 9px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
}

.guide-step-content code,
.guide-example code,
.guide-code {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.guide-example code {
    min-width: 0;
}

.guide-code,
.guide-json {
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.guide-json {
    background: #102a43;
    color: #e9f4fb;
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.82rem;
}

.guide-field-table td:first-child {
    width: 190px;
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .sticky-form {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .guide-step {
        grid-template-columns: 2.25rem minmax(0, 1fr);
        gap: 0.75rem;
    }

    .guide-step-number {
        width: 2.25rem;
        height: 2.25rem;
    }

    .guide-step:not(:last-child)::before {
        top: 2.25rem;
        left: 1.1rem;
    }

    .guide-field-table td:first-child {
        width: auto;
        white-space: normal;
    }

    .guide-example {
        display: block;
    }

    .guide-example span,
    .guide-example code {
        display: block;
    }

    .guide-example code {
        margin-top: 0.45rem;
        word-break: break-all;
    }
}
