.hale-device-page,
.hale-device-page *,
.hale-enrollment-page,
.hale-enrollment-page * {
    box-sizing: border-box;
}

.hale-device-page {
    min-height: calc(100vh - 90px);
    padding: 24px;
    background: #f4f6ef;
    color: #003306;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hale-page-title {
    margin: 0 0 16px;
    color: #003306;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.3;
}

.hale-back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    color: #657456;
    font-size: 14px;
    text-decoration: none;
}

.hale-back-link:hover,
.hale-back-link:focus {
    color: #003306;
    text-decoration: none;
}

.hale-subpage-heading {
    margin-bottom: 20px;
}

.hale-subpage-heading .hale-page-title {
    margin-bottom: 4px;
}

.hale-subpage-heading p {
    margin: 0;
    color: #778761;
    font-size: 14px;
    line-height: 1.55;
}

.hale-activity-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.hale-heading-actions,
.hale-page-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.hale-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.55;
}

.hale-alert > i {
    flex: 0 0 auto;
    margin-top: 4px;
    font-size: 15px;
}

.hale-alert strong {
    display: block;
    color: inherit;
    font-weight: 600;
}

.hale-alert p {
    margin: 2px 0 0;
    color: inherit;
}

.hale-alert-info {
    border-color: #91caff;
    background: #e6f4ff;
    color: #0958d9;
}

.hale-alert-warning {
    border-color: #ffe58f;
    background: #fffbe6;
    color: #ad6800;
}

.hale-alert-danger {
    border-color: #ffccc7;
    background: #fff2f0;
    color: #a8071a;
}

.hale-alert-success {
    border-color: #b7eb8f;
    background: #f6ffed;
    color: #135200;
}

.hale-card {
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid #dfe5d5;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 20px -2px rgba(0, 51, 6, 0.08);
}

.hale-card-header {
    min-height: 56px;
    padding: 16px 24px;
    border-bottom: 1px solid #dfe5d5;
    color: #003306;
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
}

.hale-card-body {
    padding: 24px;
}

.hale-policy-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.hale-policy-label {
    color: #003306;
    font-size: 14px;
}

.hale-secondary-text {
    color: #778761;
    font-size: 14px;
    line-height: 1.55;
}

.hale-policy-row .hale-secondary-text {
    flex: 1 1 420px;
}

.hale-inline-loader {
    color: #778761;
}

.hale-select.form-control {
    width: 150px;
    height: 32px;
    padding: 4px 30px 4px 11px;
    border-color: #d9d9d9;
    border-radius: 6px;
    background-color: #ffffff;
    color: #003306;
    font-size: 14px;
    box-shadow: none;
}

.hale-select.form-control:hover,
.hale-select.form-control:focus {
    border-color: #778761;
    outline: none;
    box-shadow: 0 0 0 2px rgba(119, 135, 97, 0.15);
}

.hale-device-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.hale-activity-button {
    position: relative;
}

.hale-alert-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 9px;
    background: #cf1322;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
}

.hale-btn.btn {
    min-height: 32px;
    padding: 5px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    box-shadow: none;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.hale-btn.btn:focus,
.hale-btn.btn:active:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(119, 135, 97, 0.18);
}

.hale-btn-primary.btn {
    border-color: #778761;
    background: #778761;
    color: #ffffff;
}

.hale-btn-primary.btn:hover,
.hale-btn-primary.btn:focus,
.hale-btn-primary.btn:active {
    border-color: #657456;
    background: #657456;
    color: #ffffff;
}

.hale-btn-default.btn {
    border-color: #d9d9d9;
    background: #ffffff;
    color: #003306;
}

.hale-btn-default.btn:hover,
.hale-btn-default.btn:focus {
    border-color: #778761;
    background: #ffffff;
    color: #778761;
}

.hale-btn-danger.btn {
    border-color: #ff4d4f;
    background: #ff4d4f;
    color: #ffffff;
}

.hale-btn-danger.btn:hover,
.hale-btn-danger.btn:focus {
    border-color: #ff7875;
    background: #ff7875;
    color: #ffffff;
}

.hale-btn.btn[disabled],
.hale-btn.btn[disabled]:hover {
    border-color: #d9d9d9;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.25);
    opacity: 1;
}

.hale-btn-block.btn {
    display: block;
    width: 100%;
}

.hale-table-wrap {
    margin: 0;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
}

.hale-table.table {
    min-width: 900px;
    margin-bottom: 0;
    color: #003306;
    font-size: 14px;
}

.hale-table.table > thead > tr > th {
    padding: 16px;
    border: 0;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    color: #003306;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.hale-table.table > tbody > tr > td {
    padding: 16px;
    border: 0;
    border-bottom: 1px solid #f0f0f0;
    background: #ffffff;
    color: #003306;
    line-height: 1.5;
    vertical-align: middle;
}

.hale-table.table > tbody > tr:last-child > td {
    border-bottom: 0;
}

.hale-table.table > tbody > tr:hover > td {
    background: #fafcf7;
}

.hale-table code {
    padding: 2px 6px;
    border: 1px solid #dfe5d5;
    border-radius: 4px;
    background: #f4f6ef;
    color: #003306;
    font-family: Consolas, "Courier New", monospace;
    white-space: nowrap;
}

.hale-status-select.form-control {
    width: 120px;
}

.hale-tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 12px;
    line-height: 20px;
    white-space: nowrap;
}

.hale-tag-active {
    border-color: #b7eb8f;
    background: #f6ffed;
    color: #389e0d;
}

.hale-tag-blocked {
    border-color: #ffd591;
    background: #fff7e6;
    color: #d46b08;
}

.hale-tag-revoked {
    border-color: #ffa39e;
    background: #fff1f0;
    color: #cf1322;
}

.hale-table-empty {
    padding: 48px 16px !important;
    color: #778761 !important;
    text-align: center;
}

.hale-toast-stack {
    position: fixed;
    top: 74px;
    left: 50%;
    z-index: 1100;
    width: min(460px, calc(100vw - 32px));
    transform: translateX(-50%);
}

.hale-toast {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    color: #003306;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(0, 51, 6, 0.16);
}

.hale-toast > span {
    flex: 1 1 auto;
}

.hale-toast > button {
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: #778761;
    font-size: 20px;
    line-height: 1;
}

.hale-toast-success > i {
    color: #17713a;
}

.hale-toast-error > i {
    color: #cf1322;
}

.hale-modal-layer {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 100px 20px 40px;
    background: rgba(0, 0, 0, 0.45);
}

.hale-modal {
    width: 100%;
    max-width: 520px;
    overflow: visible;
    border-radius: 8px;
    background: #ffffff;
    color: #003306;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.hale-confirm-modal {
    max-width: 520px;
}

.hale-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.hale-modal-header h3 {
    margin: 0;
    color: #003306;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.hale-activity-header {
    align-items: flex-start;
}

.hale-activity-header p {
    margin: 3px 0 0;
    color: #778761;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
}

.hale-modal-header > button {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(0, 0, 0, 0.45);
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
}

.hale-modal-header > button:hover {
    color: rgba(0, 0, 0, 0.88);
}

.hale-modal-body {
    padding: 24px;
}

.hale-activity-body {
    padding-top: 20px;
}

.hale-activity-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 16px;
    padding: 9px 12px;
    border: 1px solid #ffe58f;
    border-radius: 6px;
    background: #fffbe6;
    color: #ad6800;
    font-size: 13px;
}

.hale-activity-filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(130px, 0.9fr) minmax(175px, 1.25fr) minmax(145px, 0.9fr) minmax(145px, 0.9fr);
    gap: 12px;
    margin-bottom: 16px;
}

.hale-activity-filters label {
    display: block;
    margin-bottom: 6px;
    color: #003306;
    font-size: 12px;
    font-weight: 600;
}

.hale-activity-filters .form-control {
    width: 100%;
    height: 34px;
    border-color: #d9d9d9;
    border-radius: 6px;
    color: #003306;
    font-size: 13px;
    box-shadow: none;
}

.hale-activity-filters .form-control:hover,
.hale-activity-filters .form-control:focus {
    border-color: #778761;
    box-shadow: 0 0 0 2px rgba(119, 135, 97, 0.15);
}

.hale-search-input {
    position: relative;
}

.hale-search-input > i {
    position: absolute;
    top: 10px;
    left: 11px;
    z-index: 1;
    color: #778761;
}

.hale-search-input .form-control {
    padding-left: 32px;
}

.hale-activity-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    color: #778761;
    font-size: 13px;
}

.hale-activity-actions > div {
    display: flex;
    gap: 8px;
}

.hale-activity-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
}

.hale-activity-table.table {
    min-width: 1080px;
}

.hale-activity-table.table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.hale-activity-table .hale-event-time {
    width: 145px;
    white-space: nowrap;
}

.hale-event-severity {
    display: inline-block;
    min-width: 56px;
    padding: 1px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    text-transform: uppercase;
}

.hale-event-critical {
    border-color: #ffa39e;
    background: #fff1f0;
    color: #cf1322;
}

.hale-event-warning {
    border-color: #ffd591;
    background: #fff7e6;
    color: #d46b08;
}

.hale-event-success {
    border-color: #b7eb8f;
    background: #f6ffed;
    color: #389e0d;
}

.hale-event-info {
    border-color: #91caff;
    background: #e6f4ff;
    color: #0958d9;
}

.hale-activity-table td > strong,
.hale-activity-table td > small,
.hale-event-reason > strong,
.hale-event-reason > small {
    display: block;
}

.hale-event-reason {
    min-width: 260px;
}

.hale-event-reason > strong {
    font-weight: 500;
}

.hale-event-reason > small {
    margin-top: 3px;
    color: #778761;
    line-height: 1.45;
}

.hale-event-request {
    min-width: 210px;
}

.hale-event-request code {
    display: inline-block;
    max-width: 250px;
    overflow: hidden;
    vertical-align: middle;
    text-overflow: ellipsis;
}

.hale-method {
    display: inline-block;
    margin-right: 5px;
    padding: 1px 5px;
    border: 1px solid #dfe5d5;
    border-radius: 4px;
    background: #f4f6ef;
    color: #003306;
    font-size: 11px;
    font-weight: 600;
}

.hale-modal-alert {
    margin-bottom: 16px;
}

.hale-form-group {
    margin-bottom: 24px;
}

.hale-form-group > label {
    display: block;
    margin-bottom: 8px;
    color: #003306;
    font-size: 14px;
    font-weight: 400;
}

.hale-form-group .form-control,
.hale-enrollment-card .form-control,
.hale-registration-card .form-control {
    min-height: 32px;
    border-color: #d9d9d9;
    border-radius: 6px;
    color: #003306;
    box-shadow: none;
}

.hale-form-group .form-control:hover,
.hale-form-group .form-control:focus,
.hale-enrollment-card .form-control:hover,
.hale-enrollment-card .form-control:focus,
.hale-registration-card .form-control:hover,
.hale-registration-card .form-control:focus {
    border-color: #778761;
    box-shadow: 0 0 0 2px rgba(119, 135, 97, 0.15);
}

.hale-modal .chosen-container,
.hale-registration-card .chosen-container {
    width: 100% !important;
}

.hale-modal .chosen-container-multi .chosen-choices,
.hale-registration-card .chosen-container-multi .chosen-choices {
    min-height: 32px;
    padding: 2px 6px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: none;
}

.hale-modal .chosen-container-active .chosen-choices,
.hale-registration-card .chosen-container-active .chosen-choices {
    border-color: #778761;
    box-shadow: 0 0 0 2px rgba(119, 135, 97, 0.15);
}

.hale-modal .chosen-container .chosen-drop,
.hale-registration-card .chosen-container .chosen-drop {
    z-index: 1080;
}

.hale-registration-card {
    width: 100%;
    max-width: none;
    overflow: visible;
}

.hale-registration-card .hale-card-body {
    padding-bottom: 28px;
}

.hale-registration-card form {
    max-width: 620px;
}

.hale-registration-result {
    max-width: 680px;
}

.hale-registration-result > label {
    display: block;
    margin-bottom: 6px;
    color: #003306;
    font-size: 14px;
    font-weight: 600;
}

.hale-result-summary {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 8px 16px;
    margin: 0 0 24px;
    padding: 16px;
    border-radius: 8px;
    background: #f7f9f3;
    font-size: 14px;
}

.hale-result-summary dt {
    color: #778761;
    font-weight: 400;
}

.hale-result-summary dd {
    margin: 0;
    color: #003306;
    font-weight: 600;
}

.hale-field-help {
    display: block;
    margin-top: 6px;
    color: #778761;
    font-size: 12px;
    line-height: 1.5;
}

.hale-expiry-field {
    max-width: 300px;
}

.hale-registration-note {
    max-width: 620px;
    margin-top: 4px;
}

.hale-registration-card .hale-page-actions {
    margin-top: 24px;
}

.hale-link-area.form-control {
    min-height: 92px;
    margin-top: 0;
}

.hale-filter-card-body {
    padding-bottom: 16px;
}

.hale-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
    color: #778761;
    font-size: 13px;
}

.hale-activity-results-card .hale-card-body {
    padding-top: 16px;
}

.hale-validation {
    display: block;
    margin-top: 4px;
    color: #cf1322;
    font-size: 12px;
}

.hale-switch-row {
    margin: -4px 0 24px;
}

.hale-switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: #003306;
    cursor: pointer;
    font-weight: 400;
}

.hale-switch > input {
    position: absolute;
    opacity: 0;
}

.hale-switch-track {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.25);
    transition: background 0.2s;
}

.hale-switch-track > span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: left 0.2s;
}

.hale-switch > input:checked + .hale-switch-track {
    background: #778761;
}

.hale-switch > input:checked + .hale-switch-track > span {
    left: 24px;
}

.hale-switch > input:focus + .hale-switch-track {
    box-shadow: 0 0 0 2px rgba(119, 135, 97, 0.18);
}

.hale-modal-help {
    margin: 0 0 24px;
}

.hale-code-area.form-control {
    min-height: 72px;
    margin: 12px 0 16px;
    resize: vertical;
    border-color: #d9d9d9;
    border-radius: 6px;
    color: #003306;
    font-family: Consolas, "Courier New", monospace;
}

.hale-confirm-copy {
    margin: 0;
    color: #003306;
    font-size: 14px;
    line-height: 1.6;
}

.hale-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.hale-enrollment-page {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 24px;
    background: #f4f7ef;
    color: #003306;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hale-enrollment-card {
    width: 100%;
    max-width: 520px;
    padding: 24px;
    border: 1px solid #dfe5d5;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 4px 20px -2px rgba(0, 51, 6, 0.08);
}

.hale-enrollment-card h2 {
    margin: 0 0 16px;
    color: #003306;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.3;
}

.hale-enrollment-intro {
    margin: 0 0 20px;
    color: #003306;
    font-size: 14px;
    line-height: 1.6;
}

.hale-enrollment-card .hale-alert a {
    color: #17713a;
    text-decoration: underline;
}

@media (max-width: 767px) {
    .hale-device-page {
        padding: 16px 12px 24px;
    }

    .hale-page-title,
    .hale-enrollment-card h2 {
        font-size: 26px;
    }

    .hale-card-header,
    .hale-card-body,
    .hale-modal-header,
    .hale-modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hale-policy-row {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-policy-row .hale-select.form-control,
    .hale-policy-row > div {
        width: 100%;
    }

    .hale-policy-row .hale-secondary-text {
        flex: none;
    }

    .hale-device-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-device-toolbar .hale-btn {
        width: 100%;
    }

    .hale-activity-page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-heading-actions,
    .hale-page-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-heading-actions .hale-btn,
    .hale-page-actions .hale-btn {
        width: 100%;
    }

    .hale-modal-layer {
        padding: 24px 12px;
    }

    .hale-modal-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .hale-modal-actions .hale-btn {
        width: 100%;
    }

    .hale-activity-filters {
        grid-template-columns: 1fr;
    }

    .hale-activity-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-activity-actions > div {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-activity-actions .hale-btn {
        width: 100%;
    }

    .hale-filter-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .hale-result-summary {
        grid-template-columns: 1fr;
    }

    .hale-result-summary dd:not(:last-child) {
        margin-bottom: 6px;
    }

    .hale-enrollment-page {
        padding: 20px 12px;
    }
}
