/**
 * Patches on top of Synto `public/admin/assets/css/style.css` (not style.min.css — minifier breaks dark selectors).
 *
 * Do NOT import Tailwind here — Synto already ships the full utility bundle.
 */

/* —— Header responsive logos (Synto bundle has invalid :is(.dark.header…) selectors) —— */
html.dark .header .responsive-logo .responsive-logo-dark {
    display: none !important;
}

html.dark .header .responsive-logo .responsive-logo-light {
    display: block !important;
}

html.light .header .responsive-logo .responsive-logo-dark {
    display: block !important;
}

html.light .header .responsive-logo .responsive-logo-light {
    display: none !important;
}

/* —— Header icon circles + Remix icons on dark header —— */
html.dark[data-header-styles='dark'] .header .header-theme-mode button,
html.dark[data-header-styles='dark'] .header .header-search button,
html.dark[data-header-styles='dark'] .header .header-fullscreen button,
html.dark[data-header-styles='dark'] .header .header-country #dropdown-flag,
html.dark[data-header-styles='dark'] .header .header-country .header-language-flag-emoji,
html.dark[data-header-styles='dark'] .header .switcher-icon button {
    background-color: rgb(0 0 0 / 0.25) !important;
    color: rgb(255 255 255) !important;
}

html.dark[data-header-styles='dark'] .header .header-nav-right button .header-icon,
html.dark[data-header-styles='dark'] .header .header-nav-right .ti-dropdown-toggle .header-icon {
    color: rgb(255 255 255) !important;
}

/* —— Dashboard footer (admin shell) —— */
html.dark .admin-dashboard-footer {
    background-color: rgb(var(--dark-bg2)) !important;
    border-top-color: rgb(255 255 255 / 0.1) !important;
}

html.light .admin-dashboard-footer {
    background-color: #fff !important;
    border-top-color: rgb(229 231 235) !important;
}

/* —— Main cards / widgets —— */
html.dark .main-content .box {
    background-color: rgb(var(--dark-bg2)) !important;
    border: 1px solid rgb(255 255 255 / 0.08) !important;
}

html.dark .main-content .box-body {
    color: rgb(226 232 240);
}

/* —— Shared theme-aware typography (legacy — prefer field-styles sectionTitleClassName etc.) —— */
html.dark .admin-text-primary {
    color: rgb(248 250 252) !important;
}

html.dark .admin-text-secondary {
    color: rgb(203 213 225) !important;
}

html.dark .admin-text-muted {
    color: rgb(148 163 184) !important;
}

html.light .admin-text-primary {
    color: rgb(30 41 59) !important;
}

html.light .admin-text-secondary {
    color: rgb(51 65 85) !important;
}

html.light .admin-text-muted {
    color: rgb(100 116 139) !important;
}

/* —— react-hot-toast host (AdminToaster portaled to body) —— */
.admin-toast-host {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 24rem;
}
.site-brand-logo {
    width: auto;
    max-height: 56px;
    object-fit: contain;
}

.app-sidebar .main-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7.5px 1rem;
}

.app-sidebar .main-sidebar-header .header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    height: 56px;
}

.app-sidebar button.side-menu__item {
    width: 100%;
    margin: 0;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.app-sidebar .site-brand-logo {
    display: block;
    width: auto;
    height: 56px;
    max-width: 100%;
    object-fit: contain;
}

.authentication-page .site-brand-logo {
    max-height: 112px;
}

.authentication-page .auth-logo-for-dark {
    display: none;
}

html.dark .authentication-page .auth-logo-for-light {
    display: none;
}

html.dark .authentication-page .auth-logo-for-dark {
    display: block;
}

.header-language-flag {
    display: block;
    height: 1.375rem;
    width: 1.375rem;
    flex-shrink: 0;
    border-radius: 9999px;
    overflow: hidden;
}

.header .header-country #dropdown-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgb(243 244 246) !important;
    border-color: transparent !important;
}

html.dark .header .header-country #dropdown-flag {
    background-color: rgb(var(--dark-bg)) !important;
}

html.dark[data-header-styles='dark'] .header .header-country #dropdown-flag:hover {
    background-color: rgb(0 0 0 / 0.2) !important;
}

html.light .header .header-country #dropdown-flag:hover {
    background-color: rgb(229 231 235) !important;
}

.header-language-flag-wrap {
    height: 1.375rem;
    width: 1.375rem;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 9999px;
}

/* React-controlled header dropdowns: Synto hides .ti-dropdown-menu until .open is set */
.header .hs-dropdown.open > .ti-dropdown-menu,
.header .hs-dropdown.open > .hs-dropdown-menu,
.header .header-profile.open > .ti-dropdown-menu,
.header .header-profile.open > .hs-dropdown-menu {
    display: block !important;
    opacity: 1 !important;
}

/* —— Admin edit modal widths (Synto defaults .ti-modal-box to max-width: 32rem) —— */
@media (min-width: 480px) {
    .ti-modal.open .ti-modal-box.admin-modal-box--sm {
        width: 100%;
        max-width: 32rem !important;
    }

    .ti-modal.open .ti-modal-box.admin-modal-box--md {
        width: 100%;
        max-width: 48rem !important;
    }

    .ti-modal.open .ti-modal-box.admin-modal-box--lg {
        width: 100%;
        max-width: 56rem !important;
    }

    .ti-modal.open .ti-modal-box.admin-modal-box--xl {
        width: 100%;
        max-width: 80rem !important;
    }
}

.language-switcher-item--active {
    background-color: rgb(241 245 249) !important;
    color: rgb(15 23 42) !important;
}

.language-switcher-item--active p {
    color: inherit !important;
}

html.dark .language-switcher-item--active {
    background-color: rgb(var(--color-primary) / 0.28) !important;
    color: rgb(255 255 255) !important;
}

html.dark .language-switcher-item--active:hover {
    background-color: rgb(var(--color-primary) / 0.35) !important;
    color: rgb(255 255 255) !important;
}

.admin-user-avatar-initials {
    background-color: rgb(229 231 235);
    color: rgb(55 65 81);
}

html.dark .admin-user-avatar-initials:not(.admin-user-avatar-initials--on-primary) {
    background-color: rgb(var(--color-primary)) !important;
    color: rgb(255 255 255) !important;
}

html.dark[data-header-styles='dark'] .header .admin-user-avatar-initials:not(.admin-user-avatar-initials--on-primary) {
    background-color: rgb(var(--color-primary)) !important;
    color: rgb(255 255 255) !important;
    --tw-ring-color: rgb(255 255 255 / 0.15) !important;
}

.admin-user-avatar-initials--on-primary {
    background-color: rgb(0 0 0 / 0.28) !important;
    color: rgb(255 255 255) !important;
}

/* —— DataTable: ellipsis in fixed-layout cells (Synto td uses whitespace-nowrap) —— */
.main-content .ti-custom-table.table-fixed {
    table-layout: fixed !important;
    width: 100% !important;
}

.main-content .ti-custom-table.table-fixed td.admin-table-cell--truncate {
    max-width: 0 !important;
    overflow: hidden !important;
}

.main-content .ti-custom-table.table-fixed td.admin-table-cell--truncate > .admin-table-cell-truncate {
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
}

.main-content .ti-custom-table .table-format-btn {
    min-height: 0;
    padding: 0.25rem 0.5rem;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 600;
}

.main-content .ti-custom-table .ti-main-tooltip {
    position: relative;
    display: inline-block;
}

.main-content .ti-custom-table .ti-main-tooltip .ti-main-tooltip-content {
    bottom: calc(100% + 0.35rem);
    left: 50%;
    translate: -50% 0;
    white-space: nowrap;
    pointer-events: none;
}

.main-content .ti-custom-table .ti-main-tooltip:hover .ti-main-tooltip-content {
    visibility: visible;
    opacity: 1;
}

.qr-preview-shimmer {
    background-color: #cbd5e1;
    background-image: linear-gradient(
        90deg,
        #cbd5e1 0%,
        #e2e8f0 40%,
        #f1f5f9 50%,
        #e2e8f0 60%,
        #cbd5e1 100%
    );
    background-size: 200% 100%;
    animation: qr-preview-shimmer 1.15s ease-in-out infinite;
}

html.dark .qr-preview-shimmer {
    background-color: #334155;
    background-image: linear-gradient(
        90deg,
        #334155 0%,
        #475569 40%,
        #64748b 50%,
        #475569 60%,
        #334155 100%
    );
}

@keyframes qr-preview-shimmer {
    from {
        background-position: 100% 0;
    }
    to {
        background-position: -100% 0;
    }
}

/* —— Document visual builder live preview —— */
.document-builder-preview-pane {
    overflow: auto;
    max-height: calc(100vh - 14rem);
    background: #e8eaed;
    padding: 1rem;
}

.document-sheet {
    --invoice-accent: #f47927;
    --invoice-secondary: #58585a;
    --invoice-text: #666261;
    --invoice-border: #58585a;
    background: #fff;
    color: var(--invoice-text);
    font-family: 'IBM Plex Sans Condensed', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.document-sheet--preview {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
}

.document-sheet--builder {
    padding: 28mm 15.3mm 11.4mm 14.2mm;
}

.document-builder-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.document-invoice-logo {
    display: block;
    width: auto;
    height: 45pt;
    max-width: 110pt;
    max-height: 45pt;
    object-fit: contain;
}

.document-invoice-brand-name {
    color: var(--invoice-accent);
    font-size: 16pt;
    font-weight: 700;
}

.document-invoice-title-badge {
    flex: 0 0 142pt;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 142pt;
    height: 45pt;
    background: var(--invoice-accent);
    color: #fff;
    font-size: 34.3pt;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.document-invoice-title-badge span {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 142pt;
    height: 45pt;
    padding: 0 4pt 3pt;
    line-height: 1;
}

.document-invoice-contact {
    flex: 1 1 auto;
    text-align: left;
    color: #606160;
    font-size: 10.4pt;
    line-height: 1.15;
    font-weight: 700;
    min-width: 0;
}

.document-invoice-contact p {
    margin: 0;
    white-space: nowrap;
}

.document-builder-heading {
    margin: 0 0 14px;
    color: var(--invoice-secondary);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.document-builder-paragraph {
    margin: 0 0 16px;
    color: var(--invoice-text);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
}

.document-builder-fields {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.document-builder-field {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
}

.document-builder-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 4px;
}

.document-builder-value {
    font-size: 15px;
    color: var(--invoice-text);
    font-weight: 600;
    white-space: pre-wrap;
}

.document-builder-table {
    width: 100%;
    margin: 0 0 18px;
    border-top: 1.5px solid var(--invoice-border);
    border-bottom: 1.5px solid var(--invoice-border);
}

.document-builder-table-head,
.document-builder-table-body {
    display: grid;
}

.document-builder-col-head {
    background: var(--invoice-accent);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 10px 8px;
    text-align: center;
    font-size: 13px;
    border-left: 1.5px solid var(--invoice-border);
}

.document-builder-col-head:first-child {
    border-left: 0;
}

.document-builder-cell {
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--invoice-text);
    border-left: 1.5px solid var(--invoice-border);
    min-height: 72px;
}

.document-builder-cell:first-child {
    border-left: 0;
}

.document-builder-divider {
    border: 0;
    border-top: 2px solid var(--invoice-accent);
    margin: 18px 0;
}

.document-invoice-signature {
    margin-top: 16pt;
    display: flex;
    align-items: flex-end;
    width: 100%;
}

.document-invoice-signature-label {
    color: var(--invoice-accent);
    font-size: 14.7pt;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    padding-bottom: 2pt;
}

.document-invoice-signature-line {
    position: relative;
    flex: 1 1 auto;
    min-height: 42pt;
    border-bottom: 1.5pt dotted var(--invoice-accent);
    margin-left: 4pt;
}

.document-invoice-signature-image {
    position: absolute;
    left: 22%;
    bottom: -2pt;
    max-height: 17mm;
    max-width: 20mm;
    width: auto;
    height: auto;
    object-fit: contain;
}

.document-invoice-footer {
    margin-top: 16pt;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-invoice-footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18pt;
}

.document-invoice-thanks-image {
    display: block;
    max-width: 42.4mm;
    max-height: 32mm;
    width: auto;
    height: auto;
    object-fit: contain;
}

.document-invoice-thanks {
    margin: 0;
    color: var(--invoice-accent);
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 28pt;
    font-weight: 700;
    text-align: center;
}

.document-invoice-qr {
    width: 24mm;
    height: 24mm;
    flex-shrink: 0;
    background: #fff;
}

.audit-change-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.audit-change-value {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.audit-change-value.document-rich-text {
    white-space: normal;
}

.document-rich-text p {
    margin: 0 0 0.35em;
}

.document-rich-text p:last-child {
    margin-bottom: 0;
}

.document-rich-text ul,
.document-rich-text ol {
    margin: 0.25em 0 0.35em;
    padding-left: 1.25em;
}

.document-rich-text li {
    margin: 0.15em 0;
}

.document-preview-empty {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.outreach-sheet-header,
.outreach-sheet-section,
.outreach-sheet-footer {
    padding: 1.25rem 1.5rem;
}

.outreach-sheet-header {
    border-bottom: 1px solid rgb(229 231 235);
}

html.dark .outreach-sheet-header,
html.dark .outreach-sheet-section {
    border-color: rgb(255 255 255 / 0.1);
}

.outreach-sheet-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(107 114 128);
}

.outreach-sheet-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: rgb(31 41 55);
}

html.dark .outreach-sheet-title {
    color: rgb(255 255 255);
}

.outreach-sheet-meta,
.outreach-sheet-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

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

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

.outreach-sheet-section {
    border-top: 1px solid rgb(229 231 235);
}

.outreach-sheet-section h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.outreach-sheet-section label,
.outreach-sheet-meta label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
}

.outreach-sheet-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgb(107 114 128);
}

.outreach-sheet-field-value {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgb(31 41 55);
}

html.dark .outreach-sheet-field-value {
    color: rgb(248 250 252);
}

.outreach-sheet-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid rgb(229 231 235);
}

.outreach-sheet-footer p {
    margin: 0;
    font-size: 0.8rem;
    color: rgb(107 114 128);
}

/* Fill tab: form only, no dashboard chrome / sidebar offset */
.page.fill-form-page {
    margin-inline-start: 0 !important;
    min-height: 100vh;
}

.page.fill-form-page .main-content {
    margin: 0;
    padding: 1.5rem;
}

