:root {
    --ab-bg: #e8f6f5;
    --ab-bg-end: #eef8f7;
    --ab-panel: #ffffff;
    --ab-primary: #13a19c;
    --ab-primary-dark: #0e857f;
    --ab-primary-light: #9dd9d6;
    --ab-primary-rgb: 19, 161, 156;
    --ab-muted: #6f7185;
    --ab-border: #d9e6e5;
    --ab-danger: #d64556;
    --ab-font: "Montserrat", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body,
button, input, select, textarea,
.ab-btn, .ab-input, .ab-select, .ab-textarea,
.ab-field-label, .ab-auth-title, .ab-auth-subtitle {
    font-family: var(--ab-font);
}

body {
    margin: 0;
    font-family: var(--ab-font);
    color: #191a2b;
    background: radial-gradient(circle at top right, var(--ab-primary-light) 0%, var(--ab-bg) 80%, var(--ab-bg-end) 100%);
}

.ab-shell {
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.ab-shell > .ab-card.ab-split {
    width: min(1100px, 100%);
    flex-shrink: 0;
}

.ab-card {
    background: var(--ab-panel);
    border-radius: 22px;
    border: 1px solid var(--ab-border);
    box-shadow: 0 22px 56px rgba(var(--ab-primary-rgb), 0.16);
    padding: 1.25rem;
}

.ab-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 72vh;
    overflow: hidden;
}

.ab-auth-left {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.ab-auth-left-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ab-tenant-logo-slot {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 4.5rem;
    padding: 1rem 0;
}

.ab-tenant-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
    text-align: center;
}

.ab-tenant-logo img {
    display: block;
    margin: 0 auto;
    max-width: 160px;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.ab-auth-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.ab-auth-heading {
    text-align: center;
    margin-bottom: 2.25rem;
}

.ab-auth-heading .page-title {
    margin-bottom: 0.45rem;
}

.ab-auth-heading .page-subtitle {
    margin: 0;
}

.ab-busy {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.65rem;
    min-height: 11rem;
    padding: 1.5rem 1rem;
}

.ab-busy-spinner {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 3px solid #d9efee;
    border-top-color: var(--ab-primary);
    animation: ab-spin 0.75s linear infinite;
}

.ab-busy-title {
    margin: 0.4rem 0 0;
    color: #3d3f58;
    font-size: 1rem;
    font-weight: 600;
}

.ab-busy-text {
    margin: 0;
    color: #8b889c;
    font-size: 0.9rem;
}

/* Empty list / no-data / no-permission messages (UiEmpty) */
.ab-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1.75rem 1.35rem;
    text-align: center;
    box-sizing: border-box;
}

.ab-empty-state.is-page {
    min-height: min(28rem, calc(72vh - 14rem));
    padding: 2rem 1.35rem;
}

.ab-empty-state .ab-empty,
.ab-empty-state .ab-auth-hint,
.ab-empty-state .ab-error {
    margin: 0;
    max-width: 32rem;
    text-align: center;
}

.ab-empty {
    margin: 0;
    color: #8a879e;
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: center;
}

@keyframes ab-spin {
    to {
        transform: rotate(360deg);
    }
}

.ab-lang-dropdown {
    position: relative;
    display: inline-block;
}

.ab-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 8.5rem;
    border: 1px solid #d2e2e1;
    background: #fff;
    color: #3d3f58;
    border-radius: 10px;
    padding: 0.45rem 0.75rem;
    font-family: var(--ab-font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(var(--ab-primary-rgb), 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ab-lang-trigger:hover,
.ab-lang-dropdown.is-open .ab-lang-trigger {
    border-color: #8fd4d1;
    box-shadow: 0 0 0 3px rgba(var(--ab-primary-rgb), 0.12);
}

.ab-lang-chevron {
    width: 0.45rem;
    height: 0.45rem;
    margin-left: auto;
    border-right: 2px solid #8a879e;
    border-bottom: 2px solid #8a879e;
    transform: rotate(45deg) translateY(-1px);
    transition: transform 0.15s ease;
}

.ab-lang-dropdown.is-open .ab-lang-chevron {
    transform: rotate(225deg) translateY(-1px);
}

.ab-lang-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.4rem);
    z-index: 20;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    min-width: 100%;
    background: #fff;
    border: 1px solid #d7e5e4;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(var(--ab-primary-rgb), 0.16);
    animation: ab-lang-pop 0.14s ease-out;
}

@keyframes ab-lang-pop {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ab-lang-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: #3d3f58;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    font-family: var(--ab-font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}

.ab-lang-option:hover {
    background: #eef8f7;
}

.ab-lang-option.is-active {
    background: rgba(var(--ab-primary-rgb), 0.12);
    color: #0c6e69;
    font-weight: 600;
}

.ab-lang-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.35rem;
    border-radius: 6px;
    background: #d9f0ef;
    color: #0c6e69;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ab-auth-right {
    padding: 2.5rem;
    background: radial-gradient(circle at bottom right, var(--ab-primary-light) 0%, var(--ab-bg) 80%, var(--ab-bg-end) 100%);
    color: #191a2b;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.ab-auth-right-image-only {
    padding: 0;
    background: #0f1a1a;
    position: relative;
    overflow: hidden;
}

.ab-auth-right-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.ab-brand-logo {
    display: block;
    width: min(240px, 78%);
    height: auto;
    margin: 0 0 1.35rem;
}

.ab-auth-right p {
    color: var(--ab-muted);
    margin: 0 0 0.75rem;
    max-width: 28rem;
}

.ab-auth-right p:last-child {
    margin-bottom: 0;
}

.ab-auth-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.4rem 0;
    color: #0c6e69;
}

.ab-auth-subtitle {
    color: var(--ab-muted);
    margin: 0 0 1.5rem 0;
}

.ab-field-label {
    display: block;
    font-size: 0.87rem;
    margin-bottom: 0.35rem;
    color: #2a2d46;
}

.ab-required {
    color: var(--ab-danger, #c0392b);
    margin-left: 0.15rem;
    font-weight: 600;
}

.ab-field.is-invalid .ab-input,
.ab-field.is-invalid .ab-select,
.ab-field.is-invalid .ab-textarea,
.ab-field.is-invalid .ab-date-display,
.ab-field.is-invalid .ab-time-native,
.ab-field.is-invalid .ab-datetime-native {
    border-color: var(--ab-danger, #c0392b);
}

.ab-field-error {
    color: var(--ab-danger, #c0392b);
    font-size: 0.78rem;
    margin: 0.3rem 0 0;
    line-height: 1.35;
}

.ab-input, .ab-select, .ab-textarea {
    width: 100%;
    border: 1px solid #d0dfde;
    border-radius: 10px;
    padding: 0.68rem 0.8rem;
    background: #fff;
    font: inherit;
}

.ab-textarea-autosize {
    resize: none;
    overflow-y: hidden;
    line-height: 1.45;
    min-height: calc(var(--ab-ta-rows, 3) * 1.45em + 1.36rem);
    max-height: calc(var(--ab-ta-max-rows, 6) * 1.45em + 1.36rem);
}

.ab-select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #8a879e 50%),
        linear-gradient(135deg, #8a879e 50%, transparent 50%);
    background-position: calc(100% - 1.15rem) calc(50% - 0.15rem), calc(100% - 0.85rem) calc(50% - 0.15rem);
    background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
    background-repeat: no-repeat;
    padding-right: 2.2rem;
}

.ab-input:focus, .ab-select:focus, .ab-textarea:focus {
    border-color: var(--ab-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--ab-primary-rgb), 0.18);
}

.ab-date-field-control {
    position: relative;
    display: flex;
    align-items: stretch;
}

.ab-date-display {
    padding-right: 2.6rem;
}

.ab-date-picker-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6f7185;
    cursor: pointer;
    padding: 0;
    pointer-events: none;
}

.ab-date-field-control:hover .ab-date-picker-btn {
    color: var(--ab-primary-dark);
}

.ab-date-field.is-disabled .ab-date-picker-btn {
    opacity: 0.45;
}

.ab-date-picker-btn svg {
    width: 1.15rem;
    height: 1.15rem;
}

.ab-date-native {
    position: absolute;
    right: 0;
    top: 0;
    width: 2.6rem;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.ab-date-field.is-disabled .ab-date-native {
    cursor: not-allowed;
}

.ab-datetime-field .ab-date-field-control {
    display: block;
}

.ab-datetime-field .ab-datetime-native {
    position: static;
    width: 100%;
    opacity: 1;
    height: auto;
    cursor: text;
    z-index: auto;
    color-scheme: light;
}

.ab-datetime-field .ab-datetime-native::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.ab-time-field .ab-date-field-control {
    display: block;
}

.ab-time-field .ab-time-native {
    width: 100%;
    color-scheme: light;
}

.ab-time-field .ab-time-native::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.ab-date-display:focus {
    border-color: var(--ab-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--ab-primary-rgb), 0.18);
}

.ab-input:disabled,
.ab-select:disabled,
.ab-textarea:disabled {
    background: #f0f3f3;
    border-color: #d7e0df;
    color: #8a8d9c;
    cursor: not-allowed;
    opacity: 1;
    -webkit-text-fill-color: #8a8d9c;
}

.ab-field.is-disabled .ab-field-label {
    color: #8a8d9c;
}

.ab-switch-field {
    display: flex;
    flex-direction: column;
}

/* Match .ab-input / .ab-select control height so the switch lines up in form grids. */
.ab-switch-control {
    display: flex;
    align-items: center;
    min-height: calc(1.25em + 1.36rem + 2px);
}

.ab-switch {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: 3rem;
    height: 1.7rem;
    border: 0;
    border-radius: 999px;
    background: #d0dfde;
    padding: 0.18rem;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.ab-switch.is-on {
    background: var(--ab-primary);
}

.ab-switch-thumb {
    display: block;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(var(--ab-primary-rgb), 0.28);
    transition: transform 0.18s ease;
}

.ab-switch.is-on .ab-switch-thumb {
    transform: translateX(1.3rem);
}

.ab-switch:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ab-slider-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ab-slider-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.ab-slider-header .ab-field-label {
    margin-bottom: 0;
}

.ab-slider-value {
    flex-shrink: 0;
    font-size: 0.87rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ab-primary-dark, #2a2d46);
}

.ab-slider {
    width: 100%;
    height: 1.35rem;
    margin: 0;
    padding: 0;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.ab-slider:focus {
    outline: none;
}

.ab-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(var(--ab-primary-rgb), 0.18);
}

.ab-slider:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(var(--ab-primary-rgb), 0.18);
}

.ab-slider::-webkit-slider-runnable-track {
    height: 0.45rem;
    border-radius: 999px;
    background: #d0dfde;
}

.ab-slider::-webkit-slider-thumb {
    appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: -0.35rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--ab-primary);
    box-shadow: 0 1px 4px rgba(var(--ab-primary-rgb), 0.35);
}

.ab-slider::-moz-range-track {
    height: 0.45rem;
    border-radius: 999px;
    background: #d0dfde;
}

.ab-slider::-moz-range-progress {
    height: 0.45rem;
    border-radius: 999px;
    background: var(--ab-primary);
}

.ab-slider::-moz-range-thumb {
    width: 1.15rem;
    height: 1.15rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--ab-primary);
    box-shadow: 0 1px 4px rgba(var(--ab-primary-rgb), 0.35);
}

.ab-slider:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ab-field.is-disabled .ab-slider-value {
    color: #8a879e;
}

.ab-single-toggle-group-items {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch;
    width: 100%;
    max-width: 28rem;
    gap: 0.15rem;
    padding: 0.25rem;
    border-radius: 10px;
    overflow: hidden;
    background: #e8ecef;
    border: none;
    box-sizing: border-box;
}

.ab-single-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    margin: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #5a6570;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.55rem 0.75rem;
    text-align: center;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.ab-single-toggle:hover:not(:disabled):not(.is-selected) {
    background: rgba(255, 255, 255, 0.45);
    color: #3d4852;
}

.ab-single-toggle.is-selected {
    background: color-mix(in srgb, var(--ab-primary) 68%, #ffffff);
    color: #fff;
    box-shadow: none;
    z-index: 1;
}

.ab-single-toggle:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(var(--ab-primary-rgb), 0.35);
    z-index: 2;
}

.ab-single-toggle.is-selected:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.ab-single-toggle:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ab-btn {
    border: none;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.ab-btn:disabled,
.ab-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

.ab-btn-primary {
    background: var(--ab-primary);
    color: #fff;
}

.ab-btn-primary:disabled,
.ab-btn-primary[disabled] {
    background: #9bb8b6;
    color: #f3f7f7;
}

.ab-btn-secondary {
    background: #fff;
    border: 1px solid #d2e2e1;
}

.ab-btn-secondary:disabled,
.ab-btn-secondary[disabled] {
    background: #f3f6f6;
    border-color: #dde6e5;
    color: #8a9291;
}

.ab-btn-danger {
    background: var(--ab-danger);
    color: #fff;
}

.ab-btn-danger:disabled,
.ab-btn-danger[disabled] {
    background: #c9a0a0;
    color: #f7f0f0;
}

.ab-social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    border: 1px solid #d2e2e1;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    background: #fff;
    color: #191a2b;
    font-family: var(--ab-font);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.ab-social-btn:hover {
    border-color: #c0d6d4;
    background: #f5faf9;
}

.ab-social-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ab-social-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ab-social-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0;
}

.ab-social-row > * {
    flex: 1 1 calc((100% - 1rem) / 3);
    width: auto;
    min-width: 0;
}

@media (max-width: 720px) {
    .ab-social-btn {
        padding: 0.45rem 0.55rem;
        font-size: 0.82rem;
        gap: 0.35rem;
    }

    .ab-social-row {
        flex-direction: column;
        gap: 0.4rem;
    }

    .ab-social-row > * {
        flex: 1 1 auto;
        width: 100%;
    }
}

.ab-grid {
    display: grid;
    gap: 1rem;
}

.ab-grid-2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
    .ab-grid-2 {
        grid-template-columns: 1fr;
    }
}

.ab-toolbar-hint {
    min-width: 0;
}

.ab-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.ab-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(25, 26, 43, 0.45);
}

.ab-confirm-dialog {
    width: 100%;
    max-width: 28rem;
    max-height: min(90vh, 100%);
    overflow: auto;
    padding: 1.25rem 1.15rem 1.35rem;
    border-radius: 16px 16px 0 0;
    background: var(--ab-panel, #fff);
    box-shadow: 0 -12px 40px rgba(25, 26, 43, 0.18);
}

.ab-confirm-title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 650;
}

.ab-confirm-message {
    margin: 0;
    color: var(--ab-muted, #6f7185);
    font-size: 0.95rem;
    line-height: 1.45;
}

.ab-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.15rem;
}

.ab-confirm-actions .ab-btn {
    width: auto;
    min-width: 7.5rem;
}

@media (min-width: 721px) {
    .ab-confirm-backdrop {
        align-items: center;
        padding: 1.5rem;
    }

    .ab-confirm-dialog {
        border-radius: 16px;
        box-shadow: 0 22px 56px rgba(25, 26, 43, 0.2);
    }
}

.ab-form {
    display: grid;
    gap: 0.8rem;
}

.ab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ab-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(var(--ab-primary-rgb), 0.14);
    color: var(--ab-primary-dark);
    font-size: 0.75rem;
}

.ab-response {
    white-space: pre-wrap;
    background: #161925;
    color: #d4ecff;
    border-radius: 10px;
    padding: 0.75rem;
    max-height: 330px;
    overflow: auto;
    font-family: var(--ab-font);
    font-size: 0.83rem;
}

.ab-error {
    color: var(--ab-danger);
    font-size: 0.8rem;
}

@media (max-width: 980px) {
    .ab-split {
        grid-template-columns: 1fr;
    }
}
