:root {
    --mud-typography-default-family: "Roboto Condensed", sans-serif !important;
}

html,
body {
    font-family: "Roboto Condensed", sans-serif;
}

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

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.crm-record-form .mud-input-control {
    margin-top: 0.5rem;
}

.crm-record-form .mud-input-outlined {
    border-radius: 8px;
    background-color: #f8fafc;
    transition: background-color 150ms ease, box-shadow 150ms ease;
}

.crm-record-form .mud-input-outlined:hover {
    background-color: #fff;
}

.crm-record-form .mud-input-outlined.mud-input-focused {
    background-color: #fff;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 12%);
}

.crm-record-form .mud-input-label {
    font-weight: 600;
}

/* MudBlazor renders select and date-picker popovers outside the component scope. */
.mud-popover .mud-list,
.mud-popover .mud-picker,
.mud-popover .mud-picker-container,
.mud-popover .mud-paper {
    background-color: #fff;
}

.mud-popover .mud-list,
.mud-popover .mud-picker {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgb(15 23 42 / 16%);
}

/* CRM record lists use a spacious, property-table treatment. */
.crm-compact-grid .mud-table-container {
    background: #fff;
    max-height: none;
    overflow-y: visible;
}

.crm-compact-grid .mud-table-head .mud-table-cell {
    height: 56px;
    padding: 14px 18px;
    border-bottom: 1px solid #d1d5db;
    background: #f3f4f6;
    color: #374151;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.crm-compact-grid .mud-table-body .mud-table-row {
    height: 64px;
    cursor: pointer;
    background: #fff;
    transition: background-color 150ms ease;
}

.crm-compact-grid .mud-table-body .mud-table-cell {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: .875rem;
    white-space: nowrap;
}

.crm-compact-grid .mud-table-body .mud-table-cell:nth-child(2) {
    color: #1f2937;
    font-weight: 650;
}

.crm-compact-grid .mud-table-body .mud-table-row:hover {
    background: #f9fafb;
}

.crm-compact-grid .mud-icon-button {
    color: #818cf8;
}

/* CRM records component styles live globally because MudBlazor child markup is not
   consistently reached by Blazor's isolated CSS scope. */
.crm-panel {
    border: 1px solid rgb(226 232 240);
    border-radius: 1rem;
    background: white;
    box-shadow: 0 4px 18px rgb(15 23 42 / 5%);
}

.crm-breadcrumb-link {
    color: rgb(79 70 229);
    font-weight: 600;
}

.crm-breadcrumb-link:hover {
    color: rgb(55 48 163);
    text-decoration: underline;
}

.crm-primary-button {
    border-radius: .65rem;
    box-shadow: 0 4px 10px rgb(79 70 229 / 18%);
    text-transform: none;
}

.crm-search .mud-input-root {
    border-radius: .65rem;
    background: white;
}

.crm-panel th.mud-table-cell {
    background: #f2f2f2;
}

.crm-panel .mud-input-control {
    margin-top: .5rem;
}

/* Keep the template dialog opaque and above the email editor. MudBlazor renders
   dialog internals outside the component's isolated CSS scope. */
.mud-dialog-container:has(.sent-email-save-dialog) {
    z-index: 1500;
}

.sent-email-save-dialog {
    background-color: white !important;
    box-shadow: 0 24px 48px rgb(15 23 42 / 28%) !important;
    opacity: 1;
}

.sent-email-save-dialog-backdrop {
    background-color: rgb(15 23 42 / 45%) !important;
    opacity: 1 !important;
}

.crm-record-form .mud-input-outlined-border {
    border-color: rgb(203 213 225);
    border-radius: 8px;
}

.crm-record-form .mud-input-control:focus-within .mud-input-outlined-border {
    border-color: rgb(79 70 229);
    border-width: 2px;
}

.invoice-cell {
    width: 100%;
    border: 0;
    background: transparent;
    padding: .65rem .75rem;
    color: rgb(15 23 42);
    outline: none;
}

.invoice-cell:focus {
    background: rgb(238 242 255);
    box-shadow: inset 0 0 0 2px rgb(99 102 241);
}

.crm-status {
    display: inline-flex;
    border-radius: 9999px;
    background: rgb(241 245 249);
    padding: .15rem .55rem;
    color: rgb(51 65 85);
    font-size: .7rem;
    font-weight: 700;
}

@media (max-width: 640px) {
    .crm-compact-grid {
        height: auto !important;
    }
}

/* Modern CRM editor form, inspired by compact SaaS setup cards. */
.crm-form-card {
    position: relative;
    overflow: hidden;
}

.crm-form-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgb(99 102 241 / 10%), transparent 34rem),
        linear-gradient(135deg, rgb(248 250 252 / 90%), transparent 34%);
}

.crm-form-card > * {
    position: relative;
}

.crm-form-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.75rem 2rem 1.35rem;
    border-bottom: 1px solid rgb(226 232 240 / 80%);
    background: rgb(255 255 255 / 86%);
}

.crm-form-eyebrow {
    color: rgb(238 88 62);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.crm-form-title {
    margin-top: .35rem !important;
    color: rgb(15 23 42);
    font-weight: 800 !important;
    letter-spacing: -.025em;
}

.crm-form-subtitle {
    max-width: 46rem;
    margin-top: .5rem;
    color: rgb(100 116 139);
    font-size: .92rem;
    line-height: 1.55;
}

.crm-form-mode-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: rgb(255 237 213);
    padding: .35rem .8rem;
    color: rgb(234 88 12);
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
}

.crm-modern-form {
    background: rgb(255 255 255 / 78%);
}

.crm-form-section {
    margin: 1.5rem;
    padding: 1.25rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
}

.crm-form-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .95rem;
    padding-bottom: .95rem;
    border-bottom: 1px solid rgb(241 245 249);
}

.crm-form-section-heading h2 {
    margin: 0;
    color: rgb(15 23 42);
    font-size: 1.05rem;
    font-weight: 800;
}

.crm-form-section-heading p {
    margin: .25rem 0 0;
    color: rgb(100 116 139);
    font-size: .85rem;
}

/* Shared admin form fields: keep every /admin form visually aligned with CrmRecords. */
.crm-modern-form .mud-input-control,
.settings-panel form .mud-input-control,
.crm-panel form .mud-input-control {
    margin-top: .3rem;
}

.crm-modern-form .mud-input-label,
.settings-panel form .mud-input-label,
.crm-panel form .mud-input-label {
    color: rgb(30 41 59) !important;
    font-size: .9rem;
    font-weight: 800;
}

.crm-modern-form .mud-input-outlined,
.settings-panel form .mud-input-outlined,
.crm-panel form .mud-input-outlined {
    min-height: 3.1rem;
    border-radius: .8rem;
    background: #fff;
    transition: box-shadow 150ms ease, transform 150ms ease, background-color 150ms ease;
}

.crm-modern-form .mud-input-outlined:hover,
.settings-panel form .mud-input-outlined:hover,
.crm-panel form .mud-input-outlined:hover {
    background: rgb(248 250 252);
}

.crm-modern-form .mud-input-outlined.mud-input-focused,
.settings-panel form .mud-input-outlined.mud-input-focused,
.crm-panel form .mud-input-outlined.mud-input-focused {
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgb(251 113 133 / 14%), 0 10px 20px rgb(15 23 42 / 8%);
}

.crm-modern-form .mud-input-outlined-border,
.settings-panel form .mud-input-outlined-border,
.crm-panel form .mud-input-outlined-border {
    border-color: rgb(226 232 240) !important;
    border-radius: .8rem !important;
}

.crm-modern-form .mud-input-control:focus-within .mud-input-outlined-border,
.settings-panel form .mud-input-control:focus-within .mud-input-outlined-border,
.crm-panel form .mud-input-control:focus-within .mud-input-outlined-border {
    border-color: rgb(251 113 133) !important;
}

.crm-native-input {
    display: block;
    width: 100%;
    min-height: 3.1rem;
    border: 1px solid rgb(226 232 240);
    border-radius: .8rem;
    background: #fff;
    padding: .75rem 1rem;
    color: rgb(15 23 42);
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background-color 150ms ease;
}

.crm-native-input:hover {
    background: rgb(248 250 252);
}

.crm-native-input:focus,
.crm-native-input:focus-within {
    border-color: rgb(251 113 133);
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgb(251 113 133 / 14%), 0 10px 20px rgb(15 23 42 / 8%);
}

.crm-date-picker-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.crm-date-picker-row > .mud-picker {
    flex: 1 1 auto;
    min-width: 0;
}

.crm-date-picker-today-button {
    flex: 0 0 auto;
    border-color: rgb(199 210 254) !important;
    background: rgb(238 242 255) !important;
}

.crm-date-picker-current-day {
    border: 2px solid rgb(79 70 229) !important;
    border-radius: 50%;
    background: rgb(238 242 255) !important;
    color: rgb(67 56 202) !important;
    font-weight: 800 !important;
}

.crm-file-input::file-selector-button {
    margin-right: 1rem;
    border: 0;
    border-radius: .55rem;
    background: rgb(238 242 255);
    padding: .5rem 1rem;
    color: rgb(79 70 229);
    font-weight: 800;
}

.crm-native-color {
    height: 3.1rem;
    width: 5rem;
    cursor: pointer;
    border: 1px solid rgb(226 232 240);
    border-radius: .8rem;
    background: #fff;
    padding: .25rem;
}

.crm-line-items {
    margin: 0 1.5rem 1.5rem;
    overflow: hidden;
    border: 1px solid rgb(226 232 240);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
}

.crm-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    border-top: 1px solid rgb(226 232 240 / 80%);
    background: rgb(248 250 252 / 80%);
    padding: 1rem 1.5rem;
}

@media (max-width: 640px) {
    .crm-form-hero,
    .crm-form-actions {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .crm-form-hero {
        flex-direction: column;
    }

    .crm-form-section,
    .crm-line-items {
        margin-right: 1rem;
        margin-left: 1rem;
    }
}
