.heima-logout-button {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #e2e5ea;
    background: #ffffff;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.heima-logout-button:hover {
    color: #b3261e;
    border-color: #b3261e;
    background: #fbe9e7;
}

@media (prefers-color-scheme: dark) {
    .heima-logout-button {
        border-color: #333a46;
        background: #1b1f27;
        color: #9aa2b1;
    }

    .heima-logout-button:hover {
        color: #ff8a80;
        border-color: #ff8a80;
        background: rgba(255, 138, 128, 0.14);
    }
}

@media (max-width: 640px) {
    .heima-logout-button {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Shared design tokens for every Heima front-end view (#heima-companies, #heima-operators, etc.) */
.heima-ui {
    --heima-border: #e2e5ea;
    --heima-text: #1f2430;
    --heima-muted: #6b7280;
    --heima-bg: #ffffff;
    --heima-bg-subtle: #f8f9fb;
    --heima-primary: #3454d1;
    --heima-primary-hover: #2a43ac;
    --heima-success: #1a7f4e;
    --heima-success-bg: #e5f6ec;
    --heima-danger: #b3261e;
    --heima-danger-bg: #fbe9e7;
    --heima-pending: #9a6b00;
    --heima-pending-bg: #fdf3dc;
    --heima-radius: 10px;

    max-width: 760px;
    margin: 0 auto;
    color: var(--heima-text);
    font-size: 15px;
    line-height: 1.5;
}

.heima-ui.heima-ui-wide {
    max-width: 960px;
}

.heima-ui .heima-card {
    background: var(--heima-bg);
    border: 1px solid var(--heima-border);
    border-radius: var(--heima-radius);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.heima-ui h3.heima-heading {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.heima-ui .heima-form {
    display: grid;
    gap: 14px;
}

.heima-ui .heima-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.heima-ui .heima-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--heima-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.heima-ui .heima-field input[type="text"] {
    padding: 10px 12px;
    border: 1px solid var(--heima-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--heima-text);
    background: var(--heima-bg-subtle);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.heima-ui .heima-field input[type="text"]:focus {
    outline: none;
    border-color: var(--heima-primary);
    background: var(--heima-bg);
    box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.15);
}

.heima-ui .heima-field-hint {
    font-size: 12px;
    color: var(--heima-muted);
}

.heima-ui .heima-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.heima-ui .heima-btn-primary {
    background: var(--heima-primary);
    color: #ffffff;
    justify-self: start;
}

.heima-ui .heima-btn-primary:hover {
    background: var(--heima-primary-hover);
}

.heima-ui .heima-btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.heima-ui .heima-btn-ghost {
    background: transparent;
    border-color: var(--heima-border);
    color: var(--heima-danger);
    padding: 6px 12px;
    font-size: 13px;
}

.heima-ui .heima-btn-ghost:hover {
    background: var(--heima-danger-bg);
    border-color: var(--heima-danger);
}

.heima-ui .heima-notice {
    margin-top: 12px;
    font-size: 13px;
    color: var(--heima-muted);
    min-height: 1.4em;
}

.heima-ui .heima-table-wrap {
    overflow-x: auto;
}

.heima-ui table.heima-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.heima-ui table.heima-data-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--heima-muted);
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--heima-border);
    white-space: nowrap;
}

.heima-ui table.heima-data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--heima-border);
    vertical-align: top;
}

.heima-ui table.heima-data-table tbody tr:last-child td {
    border-bottom: none;
}

.heima-ui table.heima-data-table tbody tr:hover {
    background: var(--heima-bg-subtle);
}

.heima-ui table.heima-data-table tbody tr.heima-empty-row td {
    text-align: center;
    color: var(--heima-muted);
    padding: 28px 12px;
}

.heima-ui .heima-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.heima-ui .heima-badge-active {
    background: var(--heima-success-bg);
    color: var(--heima-success);
}

.heima-ui .heima-badge-refused {
    background: var(--heima-danger-bg);
    color: var(--heima-danger);
}

.heima-ui .heima-badge-pending {
    background: var(--heima-pending-bg);
    color: var(--heima-pending);
}

.heima-ui .heima-badge-view {
    background: var(--heima-bg-subtle);
    color: var(--heima-muted);
}

.heima-ui .heima-badge-operate {
    background: var(--heima-success-bg);
    color: var(--heima-success);
}

.heima-ui .heima-reason {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--heima-muted);
    max-width: 220px;
}

/* Operator enable/disable switch */
.heima-ui .heima-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}

.heima-ui .heima-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.heima-ui .heima-toggle span {
    position: absolute;
    inset: 0;
    background: var(--heima-border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.heima-ui .heima-toggle span::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.15s ease;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
}

.heima-ui .heima-toggle input:checked + span {
    background: var(--heima-success);
}

.heima-ui .heima-toggle input:checked + span::before {
    transform: translateX(16px);
}

.heima-ui select {
    padding: 6px 8px;
    border: 1px solid var(--heima-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--heima-text);
    background: var(--heima-bg-subtle);
}

.heima-ui select:focus {
    outline: none;
    border-color: var(--heima-primary);
    box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.15);
}

@media (max-width: 640px) {
    .heima-ui .heima-card {
        padding: 18px;
    }

    .heima-ui table.heima-data-table thead {
        display: none;
    }

    .heima-ui table.heima-data-table tbody tr {
        display: block;
        padding: 14px 0;
        border-bottom: 1px solid var(--heima-border);
    }

    .heima-ui table.heima-data-table tbody tr:hover {
        background: none;
    }

    .heima-ui table.heima-data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
        border-bottom: none;
        text-align: right;
    }

    .heima-ui table.heima-data-table td::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        color: var(--heima-muted);
        text-align: left;
        flex-shrink: 0;
    }

    .heima-ui .heima-reason {
        margin-left: auto;
        text-align: right;
    }
}

@media (prefers-color-scheme: dark) {
    .heima-ui {
        --heima-border: #333a46;
        --heima-text: #e7e9ee;
        --heima-muted: #9aa2b1;
        --heima-bg: #1b1f27;
        --heima-bg-subtle: #22262f;
        --heima-primary: #6f87e8;
        --heima-primary-hover: #8296ec;
        --heima-success: #5fd394;
        --heima-success-bg: rgba(95, 211, 148, 0.14);
        --heima-danger: #ff8a80;
        --heima-danger-bg: rgba(255, 138, 128, 0.14);
        --heima-pending: #e3b341;
        --heima-pending-bg: rgba(227, 179, 65, 0.14);
    }
}
