html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(
            circle at top left,
            rgba(41, 69, 93, 0.18),
            transparent 30%
        ),
        linear-gradient(180deg, rgba(9, 14, 20, 0.96), rgba(15, 22, 31, 0.98));
}

body {
    color: var(--text);
    font-family: var(--font);
}

.dispatch-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 18px;
    gap: 14px;
}

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

.dispatch-kicker {
    margin: 0 0 4px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 11px;
    font-weight: 700;
}

.dispatch-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 650;
}

.dispatch-header button,
.dispatch-btn,
.dispatch-select {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(24, 31, 40, 0.9);
    color: var(--text);
}

.dispatch-header button,
.dispatch-btn {
    padding: 10px 14px;
    cursor: pointer;
}

.dispatch-btn-secondary {
    background: rgba(53, 40, 39, 0.92);
}

.dispatch-status {
    min-height: 20px;
    font-size: 13px;
    color: rgba(233, 241, 248, 0.78);
}

.dispatch-status[data-type="success"] {
    color: #79d28a;
}

.dispatch-status[data-type="error"] {
    color: #ff8a80;
}

.dispatch-danger-alert {
    padding: 10px 12px;
    border: 1px solid rgba(255, 107, 107, 0.38);
    background: linear-gradient(
        90deg,
        rgba(92, 18, 18, 0.94),
        rgba(128, 29, 29, 0.82)
    );
    color: #ffd4cf;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    animation: cad-danger-pulse 1.35s ease-in-out infinite;
}

.dispatch-danger-alert.is-hidden {
    display: none;
}

.dispatch-warning-alert {
    padding: 10px 12px;
    border: 1px solid rgba(246, 198, 84, 0.42);
    background: linear-gradient(
        90deg,
        rgba(89, 64, 12, 0.94),
        rgba(125, 92, 18, 0.84)
    );
    color: #ffe9b2;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    animation: cad-warning-pulse 1.35s ease-in-out infinite;
}

.dispatch-warning-alert.is-hidden {
    display: none;
}

.dispatch-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 19, 26, 0.72);
}

.metric-label {
    display: block;
    margin-bottom: 8px;
    color: rgba(233, 241, 248, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

.metric-card strong {
    font-size: 28px;
    font-weight: 700;
}

.metric-card.is-danger {
    border-color: rgba(255, 107, 107, 0.34);
    background: linear-gradient(
        180deg,
        rgba(74, 17, 17, 0.86),
        rgba(22, 13, 16, 0.92)
    );
    box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.12);
    animation: cad-danger-pulse 1.35s ease-in-out infinite;
}

.metric-card.is-warning {
    border-color: rgba(246, 198, 84, 0.34);
    background: linear-gradient(
        180deg,
        rgba(92, 65, 14, 0.86),
        rgba(29, 22, 11, 0.92)
    );
    box-shadow: inset 0 0 0 1px rgba(246, 198, 84, 0.12);
    animation: cad-warning-pulse 1.35s ease-in-out infinite;
}

.dispatch-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
}

.dispatch-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 17, 24, 0.78);
    min-width: 0;
}

.dispatch-panel-open {
    grid-column: span 5;
}

.dispatch-panel-assigned {
    grid-column: span 7;
}

.dispatch-panel-groups {
    grid-column: span 8;
}

.dispatch-panel-activity {
    grid-column: span 4;
}

.dispatch-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dispatch-panel-header h3 {
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.dispatch-list {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.dispatch-inline-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dispatch-inline-header {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dispatch-card {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(19, 26, 34, 0.72);
}

.dispatch-card-interactive {
    cursor: pointer;
}

.dispatch-card-interactive:hover {
    border-color: rgba(91, 187, 255, 0.2);
    background: rgba(23, 31, 40, 0.82);
}

.dispatch-card-header,
.dispatch-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.dispatch-card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dispatch-card-header-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dispatch-card-header {
    margin-bottom: 8px;
}

.dispatch-description {
    margin: 0 0 10px;
    line-height: 1.45;
    color: rgba(241, 246, 251, 0.82);
    font-size: 13px;
}

.dispatch-meta {
    margin-bottom: 10px;
    font-size: 12px;
    color: rgba(229, 237, 244, 0.7);
}

.dispatch-badge {
    padding: 3px 7px;
    border: 1px solid rgba(91, 187, 255, 0.18);
    background: rgba(16, 43, 61, 0.7);
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
}

.dispatch-alert-badge {
    padding: 3px 7px;
    border: 1px solid rgba(255, 107, 107, 0.44);
    background: rgba(95, 23, 23, 0.88);
    color: #ffd8d1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dispatch-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(24, 31, 40, 0.92);
    color: var(--text);
    cursor: pointer;
}

.dispatch-icon-btn:hover {
    background: rgba(32, 42, 52, 0.96);
}

.dispatch-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dispatch-card.is-danger {
    border-color: rgba(255, 107, 107, 0.34);
    background: linear-gradient(
        180deg,
        rgba(69, 20, 22, 0.78),
        rgba(28, 17, 21, 0.92)
    );
    box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.1);
    animation: cad-danger-pulse 1.35s ease-in-out infinite;
}

.dispatch-card.is-danger .dispatch-meta,
.dispatch-card.is-danger .dispatch-description {
    color: rgba(255, 232, 228, 0.82);
}

.dispatch-card.is-warning {
    border-color: rgba(246, 198, 84, 0.34);
    background: linear-gradient(
        180deg,
        rgba(86, 64, 17, 0.78),
        rgba(34, 27, 16, 0.92)
    );
    box-shadow: inset 0 0 0 1px rgba(246, 198, 84, 0.1);
    animation: cad-warning-pulse 1.35s ease-in-out infinite;
}

.dispatch-card.is-warning .dispatch-meta,
.dispatch-card.is-warning .dispatch-description {
    color: rgba(255, 243, 214, 0.84);
}

.dispatch-actions-split {
    margin-top: 10px;
}

.dispatch-select {
    width: 100%;
    padding: 9px 10px;
}

.dispatch-textarea {
    width: 100%;
    min-height: 92px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(24, 31, 40, 0.92);
    color: var(--text);
    font: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.placeholder-message {
    padding: 18px;
    text-align: center;
    color: rgba(233, 241, 248, 0.6);
}

.dispatch-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    box-sizing: border-box;
}

.dispatch-modal.is-hidden {
    display: none;
}

.dispatch-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 12, 0.72);
}

.dispatch-modal-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(560px, calc(100% - 48px));
    max-height: calc(100vh - 64px);
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(11, 17, 24, 0.98);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
}

.dispatch-modal-header,
.dispatch-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.dispatch-modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dispatch-modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
}

.dispatch-modal-body {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow: auto;
}

.dispatch-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dispatch-meta-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    font-weight: 600;
}

.dispatch-modal-fields {
    display: grid;
    gap: 12px;
}

.dispatch-field {
    display: grid;
    gap: 6px;
}

.dispatch-field span {
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(233, 241, 248, 0.7);
}

.dispatch-modal-actions {
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dispatch-detail-block,
.dispatch-detail-list {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(19, 26, 34, 0.72);
}

.dispatch-detail-block {
    padding: 12px;
    color: rgba(241, 246, 251, 0.82);
    line-height: 1.45;
    white-space: pre-wrap;
}

.dispatch-detail-list {
    display: grid;
    gap: 1px;
    overflow: hidden;
}

.dispatch-detail-row {
    display: grid;
    grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px;
    background: rgba(14, 20, 28, 0.92);
}

.dispatch-detail-label {
    color: rgba(233, 241, 248, 0.64);
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dispatch-detail-value {
    color: rgba(241, 246, 251, 0.84);
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
}

@keyframes cad-danger-pulse {
    0%,
    100% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 107, 107, 0.08),
            0 0 0 rgba(255, 107, 107, 0);
    }

    50% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 141, 141, 0.22),
            0 0 18px rgba(255, 107, 107, 0.16);
    }
}

@keyframes cad-warning-pulse {
    0%,
    100% {
        box-shadow:
            inset 0 0 0 1px rgba(246, 198, 84, 0.08),
            0 0 0 rgba(246, 198, 84, 0);
    }

    50% {
        box-shadow:
            inset 0 0 0 1px rgba(251, 212, 118, 0.22),
            0 0 18px rgba(246, 198, 84, 0.16);
    }
}
