* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5f5f5;
    color: #111;
}

button {
    font: inherit;
    cursor: pointer;
}

.app {
    width: min(520px, 100%);
    margin: 0 auto;
    padding: 20px;
}

header h1 {
    margin: 4px 0 18px;
    font-size: 24px;
}

.identity-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.identity-card {
    min-height: 72px;
    border: 1px solid #ccc;
    border-radius: 7px;
    background: white;
}

.employee-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 8px 12px;
}

.employee-card small {
    margin-top: 4px;
    color: #666;
}

.status-dot {
    margin-right: 3px;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
    margin-bottom: 10px;
}

.group-help,
.direct-call {
    min-height: 70px;
    border: 1px solid #ccc;
    border-radius: 7px;
    background: white;
}

.group-help {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.main-help {
    width: 100%;
    min-height: 100px;
    margin-bottom: 14px;
    border: 1px solid #bbb;
    border-radius: 7px;
    background: white;
    font-size: 22px;
    font-weight: 700;
}

/* Lange gedrückter Hilferuf: sichtbare Sprachaufnahme. */
.main-help.is-voice-recording {
    background: #dc2626;
    border: 3px solid #991b1b;
    color: white;
    white-space: pre-line;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.16);
}

.main-help.is-voice-sending {
    background: #f59e0b;
    border: 2px solid #d97706;
    color: #111;
}

.messages {
    border-top: 1px solid #ddd;
}

.section-header {
    width: 100%;
    padding: 14px 4px;
    border: 0;
    background: transparent;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.messages-content {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 7px;
    background: white;
    color: #666;
}

.connection {
    margin-top: 14px;
    font-size: 12px;
    color: #777;
}

@media (max-width: 430px) {
    .app {
        padding: 12px;
    }

    .identity-row {
        grid-template-columns: 0.9fr 2fr 1fr;
    }
}

.pairing-panel {
    padding: 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.pairing-panel h2 {
    margin-top: 0;
    font-size: 18px;
}

.pairing-panel label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

.pairing-panel input {
    width: 100%;
    margin-top: 5px;
    padding: 10px;
    border: 1px solid #bbb;
    border-radius: 6px;
    font: inherit;
}

.pairing-panel button {
    width: 100%;
    padding: 12px;
    font-weight: 700;
}

#pairingMessage {
    margin-top: 10px;
    font-size: 13px;
}


/* ------------------------------------------------------
   Mitarbeiter-Auswahl
------------------------------------------------------ */

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.35);
}

.modal-card {
    position: relative;
    z-index: 1;

    width: min(420px, 100%);
    max-height: 80vh;

    padding: 18px;

    overflow-y: auto;

    border-radius: 10px;
    background: white;

    box-shadow:
        0 12px 36px
        rgba(0, 0, 0, 0.20);
}

.modal-card h2 {
    margin:
        0
        0
        14px;

    font-size: 18px;
}

.employee-list {
    display: flex;
    flex-direction: column;

    gap: 7px;
}

.employee-option {
    width: 100%;

    padding: 13px 14px;

    border: 1px solid #ccc;
    border-radius: 7px;

    background: white;

    text-align: left;

    font-weight: 600;
}

.employee-option:hover {
    background: #f2f2f2;
}

.employee-option.current {
    border-width: 2px;
}

.modal-cancel {
    width: 100%;

    margin-top: 14px;
    padding: 11px;

    border: 1px solid #ccc;
    border-radius: 7px;

    background: #f5f5f5;
}


.status-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.status-option {
    width: 100%;
    padding: 13px 14px;

    border: 1px solid #ccc;
    border-radius: 7px;

    background: white;

    text-align: left;
    font-weight: 600;
}

.status-option:hover {
    background: #f2f2f2;
}

.status-option.current {
    border-width: 2px;
}


/* ------------------------------------------------------
   Hilferuf
------------------------------------------------------ */

.main-help.is-cancel {
    background: #dc2626;
    border-color: #b91c1c;
    color: white;
}

.main-help.is-accepted {
    background: #7ed957;
    border-color: #65b945;
}

.main-help.is-failed {
    background: #dc2626;
    border-color: #b91c1c;
    color: white;
}

.incoming-call {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid #d98b36;
    border-radius: 8px;
    background: #f4a261;
}

.incoming-call[hidden] {
    display: none;
}

.incoming-call.success {
    background: #7ed957;
    border-color: #65b945;
}

.incoming-call-text {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.incoming-ack {
    width: 100%;
    min-height: 58px;
    border: 1px solid #aaa;
    border-radius: 7px;
    background: white;
    font-size: 17px;
    font-weight: 700;
}


.group-call {
    margin: 12px 0;
    padding: 14px;
    border: 2px solid #6d28d9;
    border-radius: 14px;
    background: #7c3aed;
    color: white;
}

.group-call[hidden] {
    display: none;
}

.group-call.success {
    background: #7ed957;
    border-color: #65b945;
    color: black;
}

.group-call-text {
    margin-bottom: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 18px;
}

.group-ack {
    width: 100%;
    min-height: 58px;
    border: 0;
    border-radius: 12px;
    background: white;
    color: #6d28d9;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
}

.group-ack:disabled {
    opacity: 0.7;
    cursor: default;
}


/* Direktruf: Empfängerauswahl */
.direct-groups { display:flex; flex-direction:column; gap:10px; margin-bottom:15px; }
.direct-groups fieldset { border:1px solid #ddd; border-radius:7px; padding:9px 12px; margin:0; }
.direct-groups legend { font-weight:700; }
.direct-groups label { display:flex; align-items:center; gap:8px; padding:5px 0; }
.direct-groups label.muted { color:#888; }
.direct-groups input { width:17px; height:17px; }
.direct-groups .group-toggle { font-weight:700; margin-bottom:4px; }
.direct-select { display:block; width:100%; padding:10px; margin-bottom:12px; border:1px solid #bbb; border-radius:7px; background:white; font:inherit; }
.direct-actions { display:flex; flex-wrap:wrap; gap:7px; }
.direct-actions button { flex:1 1 110px; padding:10px 7px; border:1px solid #ccc; border-radius:7px; background:#f7f7f7; }
.direct-actions #directApply { background:#2563eb; color:white; border-color:#2563eb; }
.direct-actions #directApply:disabled { opacity:.5; cursor:default; }
.direct-count { color:#555; font-size:13px; }

/* Direktnachricht: Aufnahme-Editor */
.direct-compose-actions { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.direct-compose-actions button { flex:1 1 130px; border:1px solid #ccc; border-radius:7px; padding:12px 8px; background:#f6f6f6; }
#directRecordStop:not(:disabled) { background:#dc2626; color:white; }
#directAudioPreview { display:block; width:100%; margin:14px 0; }
#directAudioPreview[hidden] { display:none; }
#directComposeSend:not(:disabled) { background:#2563eb; color:white; }
.direct-compose-actions button:disabled, #directComposeSend:disabled { opacity:.5; cursor:default; }
/* Empfaenger und Sprachaufnahme in einem einzigen Dialog. */
.direct-compose-inline { margin-top: 16px; padding-top: 10px; border-top: 1px solid #ddd; }
.direct-compose-inline h3 { margin: 8px 0; }
#directModal .modal-card { max-height: 90vh; }

/* Web-Nachrichteneingang */
.inbox-item { display:flex; gap:10px; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid #e5e7eb; color:#111; }
.inbox-item strong { min-width:0; flex:1; overflow-wrap:break-word; }
.inbox-item button { padding:9px 12px; border:1px solid #bbb; border-radius:7px; background:white; flex-shrink:0; }

/* Nachrichten-Player: eine Zeile pro Nachricht, Player darunter. */
.inbox-entry { min-width:0; border-bottom:1px solid #e5e7eb; padding-bottom:9px; }
.inbox-entry .inbox-item { border-bottom:0; }
.inbox-audio { display:block; width:100%; max-width:100%; margin:6px 0; }
.inbox-audio-info { display:block; color:#6b7280; font-size:11px; padding:0 2px; }
