html, body {
    margin: 0;
    padding: 0;
    background: #e9edf1;
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
}

* { box-sizing: border-box; }

body { padding-bottom: 110px; }

.appShell {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 12px 24px;
}

.appHeader {
    padding: 18px 4px 10px;
}

.appHeaderText h1 {
    margin: 0;
    font-size: 30px;
}

.appHeaderText p {
    margin: 4px 0 0;
    color: #555;
}

.cardSection {
    background: #fff;
    border: 1px solid #d4d9df;
    border-radius: 12px;
    margin: 0 0 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.catHeaderDiv {
    background: #f0f200;
    color: #111;
    font-weight: bold;
    padding: 12px 14px;
    border-bottom: 1px solid #d6d900;
}

.rowDiv { padding: 14px; }

.formGrid {
    display: grid;
    gap: 14px;
}

.formGridTwo {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fieldStack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.labelText {
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

input, select, textarea, button {
    font: inherit;
}

input[type="text"], input[type="tel"], input[type="number"], input[type="datetime-local"], select, textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid #c8d0d8;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: #222;
    -webkit-text-fill-color: #222;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.2;
}

textarea { min-height: 100px; resize: vertical; }

select, input[type="datetime-local"] {
    height: 48px;
}

input[type="datetime-local"]::-webkit-date-and-time-value {
    text-align: left;
    color: #222;
}


input:disabled {
    background: #f5f6f7;
    color: #666;
}

.secondaryButton, .primaryButton {
    border: 0;
    border-radius: 10px;
    min-height: 46px;
    padding: 12px 16px;
    font-weight: bold;
    cursor: pointer;
}

.secondaryButton {
    background: #dfe5ea;
    color: #222;
}

.primaryButton {
    background: #f0f200;
    color: #111;
}

.objectContainer {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.objectCard {
    border: 1px solid #d8dee5;
    border-radius: 10px;
    background: #fafbfc;
    overflow: hidden;
}

.objectHeader {
    background: #eef2f5;
    padding: 10px 14px;
    font-weight: bold;
    border-bottom: 1px solid #d8dee5;
}

.sectionActionRow {
    padding: 0 14px 14px;
}

.summaryStack input {
    background: #f5f6f7;
}

.actionBar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(233, 237, 241, .96);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0,0,0,.08);
}

.actionBarInner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.actionButton {
    min-height: 56px;
}

.statusButton {
    margin-left: auto;
    min-width: 180px;
    width: 34%;
}

.loading {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.28);
    color: #fff;
    font-size: 24px;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.loading.show {
    display: flex;
}

.hiddenByFlow {
    display: none !important;
}

@media (max-width: 820px) {
    .formGridTwo {
        grid-template-columns: 1fr;
    }

    .statusButton {
        width: 42%;
    }
}

@media (max-width: 560px) {
    .actionBarInner {
        gap: 8px;
    }

    .actionButton {
        min-height: 52px;
        padding: 10px 12px;
    }

    .statusButton {
        width: 46%;
        min-width: 140px;
    }
}


.objectHeaderRow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.removeObjectButton {
    white-space: nowrap;
}

.appModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.appModal.show {
    display: block;
}

.appModalBackdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.appModalDialog {
    position: relative;
    max-width: 860px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
    padding: 20px;
    max-height: calc(100vh - 80px);
    overflow: auto;
}

.appModalDialogSmall {
    max-width: 560px;
}

.appModalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.appModalHeader h2 {
    margin: 0;
    font-size: 24px;
}

.modalCloseButton {
    background: transparent;
    border: 0;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.modalInfoBox {
    padding: 12px 14px;
    border: 1px solid #d7d7d7;
    border-radius: 10px;
    background: #f5f6f7;
    margin-bottom: 16px;
    line-height: 1.5;
}

.historyList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.historyRow {
    border: 1px solid #d7d7d7;
    border-radius: 12px;
    padding: 14px;
    background: #ffffff;
}

.historyMetaTop {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.historyJobId {
    font-size: 18px;
    font-weight: 700;
}

.historyMetaGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    line-height: 1.4;
}

.historyActions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.historyEmpty {
    padding: 18px;
    border: 1px dashed #c4c4c4;
    border-radius: 12px;
    background: #fafafa;
}

.modalText {
    margin: 0 0 18px;
    line-height: 1.5;
}

.modalActionRow {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 700px) {
    .appModalDialog {
        margin: 16px;
        max-height: calc(100vh - 32px);
        padding: 16px;
    }

    .historyMetaGrid {
        grid-template-columns: 1fr;
    }

    .objectHeaderRow {
        flex-direction: column;
        align-items: flex-start;
    }

    .modalActionRow {
        flex-direction: column;
    }

    .modalActionRow button,
    .historyActions button,
    .modalCloseButton {
        width: 100%;
    }
}


.statusSummaryGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

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

.statusSummaryLabel {
    font-size: 14px;
    color: #555;
    font-weight: 700;
}

.statusSummaryValue {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.sendStatusBadge,
.historySendState {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.sendStatusOk,
.sendStateOk {
    color: #18794e;
}

.sendStatusError,
.sendStateError {
    color: #b42318;
}

.sendStatusEdited,
.sendStateEdited {
    color: #b54708;
}

.sendStatusNeutral {
    color: #555;
}

.historyMetaGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.historySendStateWrap {
    grid-column: span 2;
}

@media (max-width: 820px) {
    .statusSummaryGrid {
        grid-template-columns: 1fr;
    }

    .historyMetaGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .historySendStateWrap {
        grid-column: span 2;
    }
}
