:root {
    --bg: #f6efe5;
    --panel: #fffaf4;
    --panel-strong: #ffffff;
    --text: #2d241d;
    --muted: #6f6258;
    --line: #dccfbe;
    --brand: #0f766e;
    --brand-strong: #115e59;
    --accent: #f68920;
    --danger-bg: #fde8e8;
    --danger-text: #9b1c1c;
    --shadow: 0 18px 60px rgba(45, 36, 29, 0.12);
    --motion-duration-instant: 110ms;
    --motion-duration-fast: 160ms;
    --motion-duration-base: 220ms;
    --motion-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --motion-ease-in: cubic-bezier(0.7, 0, 0.84, 0);
    --motion-ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 30%),
        linear-gradient(135deg, #f8f2ea 0%, #efe3d4 100%);
}

.auth-page,
.dashboard-page {
    display: grid;
    padding: 32px;
}

.auth-page {
    place-items: center;
}

.login-page {
    min-height: 100vh;
    padding: 0;
    place-items: stretch;
    position: relative;
    isolation: isolate;
    font-family: "Lato", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #171817;
}

.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(90deg, rgba(9, 10, 9, 0.2) 0%, rgba(9, 10, 9, 0.32) 48%, rgba(9, 10, 9, 0.58) 100%),
        url("assets/magilarmes-login-bg-v2.jpg") center / cover no-repeat;
}

.login-page::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 17% 48%, rgba(255, 187, 0, 0.12), transparent 28rem),
        linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.22));
}

.dashboard-page {
    place-items: start center;
    padding-top: 12px;
}

.auth-card,
.shell {
    width: min(100%, 980px);
}

.login-shell {
    width: min(100% - 44px, 1120px);
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(170px, 25%) minmax(0, 75%);
    grid-template-rows: auto auto;
    column-gap: 42px;
    row-gap: 14px;
    align-items: center;
    align-content: center;
    padding: 42px 0 16px;
}

.login-brand {
    justify-self: center;
    align-self: start;
    width: 170px;
    display: grid;
    gap: 5px;
    text-decoration: none;
}

.login-brand img {
    display: block;
    width: 100%;
    height: auto;
}

.login-brand-lower {
    width: 134px;
    justify-self: center;
}

.page-shell {
    width: min(100%, 1120px);
    display: grid;
    gap: 18px;
}

.area-switcher-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.settings-subnav {
    margin-top: -6px;
}

.settings-subnav .area-switcher-link {
    position: relative;
    min-height: 112px;
    align-content: center;
    gap: 6px;
    padding: 20px 104px 20px 22px;
    overflow: hidden;
}

.area-switcher-link {
    display: grid;
    gap: 4px;
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 250, 244, 0.78);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    transition: transform 180ms var(--motion-ease-out), border-color 180ms var(--motion-ease-out), background-color 180ms var(--motion-ease-out);
}

.area-switcher-link strong {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
}

.settings-subnav .settings-nav-icon {
    position: absolute;
    top: 50%;
    right: 24px;
    display: grid;
    width: 58px;
    height: 58px;
    transform: translateY(-50%);
    place-items: center;
    color: initial;
    background: transparent;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 2.45rem;
    line-height: 1;
    pointer-events: none;
}

.heading-with-icon {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.heading-icon {
    flex: 0 0 auto;
    font-size: 0.9em;
    line-height: 1;
}

.area-switcher-link span {
    color: var(--muted);
    line-height: 1.45;
}

.area-switcher-link:hover {
    transform: translateY(-1px);
    border-color: var(--brand);
}

.area-switcher-link.is-active {
    border-color: rgba(15, 118, 110, 0.5);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0.82));
}

@media (max-width: 480px) {
    .settings-subnav .area-switcher-link {
        min-height: 104px;
        padding-right: 82px;
    }

    .settings-subnav .settings-nav-icon {
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 2.1rem;
    }
}

.auth-page .page-shell {
    justify-items: center;
}

.auth-card {
    max-width: 620px;
    width: min(100%, 620px);
    background: var(--panel-strong);
    border: 1px solid rgba(220, 207, 190, 0.9);
    border-radius: 24px;
    padding: 36px;
    box-shadow: var(--shadow);
}

.login-page .auth-card {
    width: min(100%, 760px);
    max-width: none;
    justify-self: end;
    display: grid;
    gap: 20px;
    padding: 40px 44px 34px;
    border: 1px solid #dddddd;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.22);
}

.login-intro {
    display: grid;
    gap: 10px;
    text-align: center;
}

.login-intro > span {
    color: #f68920;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-intro h1 {
    margin: 0;
    color: #363636;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.login-page .licensed-login {
    margin: 0;
    color: #585858;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.auth-card h1,
.auth-card .licensed-login {
    text-align: center;
}

.shell {
    display: grid;
    gap: 24px;
    width: 100%;
    min-width: 0;
}

.shell-header,
.grid {
    display: grid;
    gap: 16px;
}

.grid-wide {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    align-items: start;
}

.shell-header {
    grid-template-columns: 1fr auto;
    align-items: start;
}

.shell-header-main {
    min-width: 0;
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.sage-accountant-open-button {
    min-width: 0;
    padding-inline: 16px;
}

.sage-customer-balance {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 2px 8px;
    min-width: 142px;
    padding: 8px 12px;
    border: 1px solid rgba(15, 118, 110, 0.24);
    border-radius: 10px;
    background: rgba(255, 253, 249, 0.86);
    color: var(--brand);
    text-align: right;
}

.sage-customer-balance.has-debt {
    border-color: rgba(155, 28, 28, 0.28);
    color: var(--danger-text);
}

.sage-customer-balance.has-credit {
    border-color: rgba(15, 118, 110, 0.28);
    color: var(--brand);
}

.sage-customer-balance span,
.sage-customer-balance small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-customer-balance strong {
    font-size: 1rem;
    white-space: nowrap;
}

.sage-customer-balance small {
    grid-column: 1 / -1;
    text-transform: none;
}

.sage-customer-page {
    position: relative;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.74) 0, rgba(0, 0, 0, 0.74) 168px, transparent 168px),
        linear-gradient(135deg, #f7f1ea 0%, #eee1d0 100%);
    font-family: "Lato", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.sage-customer-page::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: 168px;
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.58)),
        url("assets/pos-hero.jpg") center 45% / cover no-repeat;
}

.sage-customer-page .page-shell {
    width: min(100% - 32px, 1540px);
    padding-top: 18px;
}

.sage-customer-page .shell-header,
.sage-customer-page .sage-outstanding-panel,
.sage-customer-page .sage-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(220, 207, 190, 0.92);
    border-radius: 12px;
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 18px 55px rgba(45, 36, 29, 0.14);
}

.sage-customer-page .shell-header {
    grid-template-columns: minmax(0, 1fr) max-content;
    padding: 22px 26px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 244, 0.96)),
        #fff;
}

.sage-customer-page .shell-header > div:first-child {
    min-width: 0;
}

.sage-customer-page .header-actions {
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
}

.sage-customer-page .shell-header::before,
.sage-customer-page .sage-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, #f68920 0%, #ffb10a 42%, #00615b 100%);
}

.sage-customer-page .shell-header h1 {
    color: #2d241d;
    text-transform: uppercase;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(1.3rem, 2.6vw, 2rem);
    letter-spacing: 0;
}

.sage-customer-page .lead {
    color: #585858;
    margin-bottom: 0;
}

.sage-customer-page .sage-customer-balance {
    border-color: rgba(246, 137, 32, 0.28);
    border-radius: 8px;
    background: #fff;
}

.sage-customer-page .logout-link,
.sage-customer-page .sage-filter-bar button,
.sage-customer-page .sage-filter-button.is-active,
.sage-customer-page .sage-tab.is-active,
.sage-customer-page .sage-type-tab.is-active {
    background: #f68920;
}

.sage-customer-page .logout-link:hover,
.sage-customer-page .sage-filter-bar button:hover,
.sage-customer-page .sage-filter-button:hover,
.sage-customer-page .sage-type-tab:hover {
    background: #da7009;
}

.sage-customer-page .sage-tab:hover,
.sage-customer-page .sage-tab:focus {
    background: transparent;
}

.sage-customer-page .sage-tab,
.sage-customer-page .sage-type-tab,
.sage-customer-page .sage-filter-button,
.sage-customer-page .sage-payment-filter {
    border-radius: 8px;
}

.sage-customer-page .sage-outstanding-panel {
    position: sticky;
    top: 10px;
    z-index: 20;
    border-color: rgba(246, 137, 32, 0.24);
    background: rgba(255, 250, 244, 0.97);
}

.sage-customer-page .sage-panel {
    padding-top: 32px;
}

.sage-customer-page .sage-tabs {
    border-color: rgba(246, 137, 32, 0.24);
    background: #fff7ed;
}

.sage-customer-page .sage-tab {
    color: #363636;
}

.sage-customer-page .sage-section-heading h2,
.sage-customer-page .sage-month-header h3 {
    color: #2d241d;
}

.sage-customer-page .sage-kpis div {
    border-radius: 8px;
    background: #fff;
}

.sage-customer-page .sage-table-wrap {
    border-radius: 10px;
    background: #fff;
}

.sage-customer-page .sage-data-table thead th,
.sage-customer-page .sage-lines-table thead th {
    background: #fff7ed;
}

.sage-customer-page .site-footer {
    padding: 4px 12px 0;
}

.sage-customer-page .site-footer p {
    color: rgba(45, 36, 29, 0.76);
}

.sage-customer-page .site-footer a {
    color: #00615b;
}

.sage-customer-page .site-footer a:hover {
    color: #f68920;
}

.sage-outstanding-panel {
    display: grid;
    grid-template-columns: minmax(240px, 25%) clamp(18px, 2.5vw, 42px) minmax(0, 1fr);
    gap: 0;
    padding: 12px;
    border: 1px solid rgba(155, 28, 28, 0.22);
    border-radius: 12px;
    background: rgba(255, 250, 244, 0.9);
    box-shadow: 0 12px 32px rgba(45, 36, 29, 0.07);
}

.sage-outstanding-panel.has-credit {
    border-color: rgba(15, 118, 110, 0.24);
}

.sage-outstanding-panel > div:first-child {
    display: grid;
    align-content: start;
    gap: 4px;
}

.sage-outstanding-list {
    grid-column: 3;
}

.sage-payment-box {
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    row-gap: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(220, 207, 190, 0.8);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 239, 0.94)),
        #fffdf9;
}

.sage-payment-box > span {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    color: #5b5148;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sage-outstanding-panel > div:first-child span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-outstanding-panel .sage-payment-box > span {
    color: #5b5148;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.03em;
}

.sage-outstanding-panel > div:first-child strong {
    color: var(--danger-text);
    font-size: 1.18rem;
}

.sage-payment-logo {
    display: block;
    grid-column: 1;
    grid-row: 2;
    width: 70px;
    height: auto;
    margin: 0;
}

.sage-payment-details {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    gap: 7px;
    margin: 0;
}

.sage-payment-details div {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) auto;
    gap: 12px;
    align-items: baseline;
}

.sage-payment-details dt {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-payment-details dd {
    margin: 0;
    color: var(--danger-text);
    font-size: 1rem;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.sage-payment-details div:last-child dd {
    font-size: 1.16rem;
}

.sage-paylink-form {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 4px 0 0;
}

.sage-paylink-form button {
    width: 100%;
    min-height: 34px;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    background: #11867b;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(17, 134, 123, 0.18);
}

.sage-paylink-form button:hover,
.sage-paylink-form button:focus-visible {
    background: #0d746b;
    outline: 0;
}

.sage-outstanding-panel.has-credit > div:first-child strong {
    color: var(--brand);
}

.sage-outstanding-list {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        clamp(18px, 2.5vw, 42px)
        minmax(0, 1fr)
        clamp(18px, 2.5vw, 42px)
        minmax(0, 1fr);
    gap: 6px 0;
    max-height: 180px;
    overflow: auto;
}

.sage-outstanding-entry:nth-child(3n+1) {
    grid-column: 1;
}

.sage-outstanding-entry:nth-child(3n+2) {
    grid-column: 3;
}

.sage-outstanding-entry:nth-child(3n) {
    grid-column: 5;
}

.sage-outstanding-entry {
    display: grid;
    grid-template-columns: minmax(0, max-content) auto;
    gap: 3px 8px;
    align-items: center;
    justify-self: start;
    min-width: 0;
}

.sage-outstanding-item {
    display: inline-grid;
    grid-template-columns: minmax(0, max-content) auto;
    gap: 1px 8px;
    align-items: center;
    justify-self: start;
    min-height: 32px;
    padding: 3px 4px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
}

.sage-outstanding-item:hover,
.sage-outstanding-item:focus-visible {
    background: rgba(246, 137, 32, 0.08);
    outline: 0;
}

.sage-outstanding-title {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    font-weight: 800;
    line-height: 1.15;
    width: max-content;
    max-width: 100%;
}

.sage-outstanding-title .sage-payment-status {
    flex: 0 0 auto;
}

.sage-outstanding-item small {
    color: var(--muted);
    grid-column: 1;
    grid-row: 2;
    font-size: 0.78rem;
    line-height: 1.2;
}

.sage-outstanding-item strong {
    grid-column: 2;
    grid-row: 2;
    white-space: nowrap;
    font-size: 0.94rem;
    line-height: 1.15;
    justify-self: end;
}

.sage-outstanding-item.has-debt strong {
    color: var(--danger-text);
}

.sage-outstanding-entry.has-debt .sage-outstanding-item strong {
    color: var(--danger-text);
}

.sage-outstanding-entry.has-credit .sage-outstanding-item strong,
.sage-outstanding-item.has-credit strong {
    color: var(--brand);
}

@media (max-width: 1180px) {
    .sage-outstanding-panel {
        grid-template-columns: minmax(220px, 26%) clamp(14px, 2vw, 28px) minmax(0, 1fr);
    }

    .sage-outstanding-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 14px;
    }

    .sage-outstanding-entry:nth-child(n),
    .sage-outstanding-item:nth-child(n) {
        grid-column: auto;
    }
}

.header-settings-button {
    min-width: 0;
    padding: 14px 20px;
    border-radius: 999px;
    background: #3d342d;
    color: #fff;
    border: 0;
}

.header-settings-button:hover {
    background: var(--brand-strong);
}

.grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
    background: rgba(255, 250, 244, 0.94);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.panel-subtle {
    background: rgba(255, 253, 249, 0.9);
    box-shadow: none;
}

.panel-subtle h3 {
    font-size: 1.45rem;
}

.eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--brand-strong);
    margin-bottom: 10px;
}

h1,
h2,
p,
ul {
    margin-top: 0;
}

h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

h1,
h2,
label,
button,
.logout-link,
.file-upload-button,
.search-button,
.search-reset,
.mini-delete-button {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    margin-bottom: 12px;
}

h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.lead,
li,
p {
    color: var(--muted);
    line-height: 1.6;
}

.licensed-login {
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.session-meta {
    margin-bottom: 0;
}

.session-line {
    display: grid;
    gap: 2px;
    width: 100%;
    max-width: 100%;
    grid-column: 1 / -1;
    margin-top: -4px;
}

.company-meta,
.session-meta {
    margin-bottom: 0;
}

.company-meta strong {
    color: var(--text);
}

.site-footer {
    text-align: center;
    padding: 4px 12px 0;
}

.site-footer p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.site-footer a {
    color: var(--brand-strong);
    text-decoration: none;
    font-weight: 700;
}

.site-footer a:hover {
    text-decoration: underline;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.auth-form {
    display: grid;
    gap: 12px;
    margin-top: 24px;
    justify-items: center;
}

.auth-reset-form {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    justify-items: center;
}

.login-page .auth-form,
.login-page .auth-reset-form {
    width: min(100%, 360px);
    justify-self: center;
    display: grid;
    gap: 15px;
    margin-top: 2px;
}

.login-page .auth-form {
    width: min(100%, 700px);
    grid-template-columns: minmax(300px, 360px) 304px;
    grid-template-rows: auto auto auto;
    align-items: center;
    justify-content: center;
}

.login-page .auth-form label,
.login-page .auth-reset-form label {
    position: relative;
    display: block;
    width: 100%;
}

.login-page .auth-form label {
    grid-column: 1;
}

.login-page .auth-form label span,
.login-page .auth-reset-form label span {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    padding: 0 6px;
    background: #fff;
    color: #363636;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: transform 140ms var(--motion-ease-out), color 140ms var(--motion-ease-out), opacity 140ms var(--motion-ease-out);
    pointer-events: none;
}

.login-page .auth-form input,
.login-page .auth-reset-form input {
    width: 100%;
    height: 48px;
    border: 1px solid #d9d9d9;
    border-radius: 0;
    background: #fff;
    color: #363636;
    padding: 14px 16px 10px;
}

.login-page .auth-form input:focus,
.login-page .auth-reset-form input:focus {
    outline: 0;
    border-color: #f68920;
}

.login-page .auth-form label:focus-within span,
.login-page .auth-form label:has(input:not(:placeholder-shown)) span,
.login-page .auth-reset-form label:focus-within span,
.login-page .auth-reset-form label:has(input:not(:placeholder-shown)) span {
    top: 0;
    color: #f68920;
    font-size: 0.72rem;
    transform: translateY(-50%);
}

.auth-turnstile {
    width: min(100%, 304px);
    min-height: 65px;
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
    display: grid;
    place-items: center;
}

.login-page .auth-form button,
.login-page .auth-reset-form button {
    justify-self: center;
    min-width: 240px;
    height: 55px;
    margin-top: 8px;
    padding: 0 30px;
    border-radius: 26px;
    background: #f68920;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
}

.login-page .auth-form button {
    grid-column: 1 / -1;
}

.login-page .auth-form button:hover,
.login-page .auth-reset-form button:hover {
    background: #da7009;
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.auth-links a {
    color: #00615b;
    font-weight: 800;
    text-decoration: none;
}

.auth-links a:hover {
    color: #f68920;
}

.customer-portal-page {
    min-height: 100vh;
    margin: 0;
    position: relative;
    isolation: isolate;
    font-family: "Lato", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #585858;
    background: #171817;
}

.customer-portal-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(90deg, rgba(9, 10, 9, 0.2) 0%, rgba(9, 10, 9, 0.32) 48%, rgba(9, 10, 9, 0.58) 100%),
        url("assets/magilarmes-login-bg-v2.jpg") center / cover no-repeat;
}

.customer-portal-page::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 17% 48%, rgba(255, 187, 0, 0.12), transparent 28rem),
        linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.22));
}

.customer-site-header {
    position: relative;
    z-index: 2;
    min-height: 40px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.customer-site-topbar-inner {
    width: min(100% - 44px, 1920px);
    margin: 0 auto;
    min-height: 39px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.customer-site-contact {
    display: flex;
    align-items: center;
    gap: 34px;
    flex-wrap: wrap;
}

.customer-site-contact a {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 0.94rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 100ms var(--motion-ease-out);
}

.customer-site-contact a:hover {
    color: #f68920;
}

.customer-site-contact i {
    position: relative;
    top: 1px;
    font-size: 1.25rem;
}

.customer-portal-shell {
    width: min(100% - 44px, 1120px);
    min-height: calc(100vh - 40px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(170px, 25%) minmax(0, 75%);
    grid-template-rows: auto auto;
    column-gap: 42px;
    row-gap: 14px;
    align-items: center;
    align-content: center;
    padding: 42px 0 16px;
}

.customer-portal-logo {
    justify-self: center;
    align-self: start;
    width: 170px;
    display: grid;
    gap: 5px;
}

.customer-portal-logo img {
    display: block;
    width: 100%;
    height: auto;
}

.customer-portal-logo-upper,
.customer-portal-logo-lower {
    user-select: none;
}

.customer-portal-logo-lower {
    width: 134px;
    justify-self: center;
}

.customer-portal-card {
    width: min(100%, 760px);
    justify-self: end;
    display: grid;
    gap: 20px;
    padding: 40px 44px 34px;
    border: 1px solid #dddddd;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.22);
}

.customer-portal-intro {
    display: grid;
    gap: 10px;
    text-align: center;
}

.customer-portal-intro > span {
    color: #f68920;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.customer-portal-intro h1 {
    margin: 0;
    color: #363636;
    font-size: clamp(2rem, 4vw, 2.9rem);
    line-height: 1.1;
    letter-spacing: 0;
    text-transform: uppercase;
}

.customer-portal-intro h1 span {
    color: #f68920;
}

.customer-portal-intro p {
    margin: 0;
    color: #585858;
    font-size: 1rem;
    line-height: 1.35;
}

.customer-portal-intro-line {
    display: block;
}

.customer-portal-intro-line + .customer-portal-intro-line {
    margin-top: 0.08rem;
}

.customer-portal-form {
    width: min(100%, 700px);
    justify-self: center;
    display: grid;
    grid-template-columns: minmax(300px, 360px) 304px;
    grid-template-rows: auto auto auto;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.customer-portal-form label {
    position: relative;
    display: block;
    grid-column: 1;
}

.customer-portal-form label span {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    padding: 0 6px;
    background: #fff;
    color: #363636;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: transform 140ms var(--motion-ease-out), color 140ms var(--motion-ease-out), opacity 140ms var(--motion-ease-out);
    pointer-events: none;
}

.customer-portal-form input {
    height: 48px;
    border: 1px solid #d9d9d9;
    border-radius: 0;
    background: #fff;
    color: #363636;
    padding: 14px 16px 10px;
}

.customer-portal-form input:focus {
    outline: 0;
    border-color: #f68920;
}

.customer-portal-form label:focus-within span,
.customer-portal-form label:has(input:not(:placeholder-shown)) span {
    top: 0;
    color: #f68920;
    font-size: 0.72rem;
    transform: translateY(-50%);
}

.customer-portal-turnstile {
    width: min(100%, 304px);
    min-height: 65px;
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
    display: grid;
    place-items: center;
}

.customer-portal-form button {
    grid-column: 1 / -1;
    justify-self: center;
    min-width: 240px;
    height: 55px;
    margin-top: 8px;
    padding: 0 30px;
    border-radius: 26px;
    background: #f68920;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
}

.customer-portal-form button:hover {
    background: #da7009;
}

.customer-portal-note,
.customer-portal-backoffice-link {
    margin: 0;
    text-align: center;
    color: #777;
    font-size: 0.9rem;
    line-height: 1.5;
}

.customer-portal-access-links {
    display: grid;
    gap: 0.2rem;
}

.customer-portal-backoffice-link {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.customer-portal-backoffice-link:hover,
.customer-portal-backoffice-link:focus-visible {
    color: #cf0000;
}

.customer-portal-shell .site-footer {
    grid-column: 2;
    justify-self: end;
    width: min(100%, 760px);
    padding-top: 0;
}

.customer-portal-page .site-footer p,
.customer-portal-page .site-footer a {
    color: rgba(255, 255, 255, 0.82);
}

.customer-portal-page .site-footer a:hover {
    color: #f68920;
}

.login-shell .site-footer {
    grid-column: 2;
    justify-self: end;
    width: min(100%, 760px);
    padding-top: 0;
}

.login-page .site-footer p,
.login-page .site-footer a {
    color: rgba(255, 255, 255, 0.82);
}

.login-page .site-footer a:hover {
    color: #f68920;
}

.auth-recovery-link {
    margin: 14px 0 0;
    text-align: center;
}

.auth-recovery-link a {
    color: var(--brand-strong);
    text-decoration: none;
    font-weight: 700;
}

.auth-recovery-link a:hover {
    text-decoration: underline;
}

.auth-form label,
.auth-form input,
.auth-form button,
.auth-reset-form label,
.auth-reset-form input,
.auth-reset-form button {
    width: min(50%, 260px);
}

.auth-form label,
.auth-reset-form label {
    justify-self: center;
    text-align: left;
}

label {
    font-weight: 700;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    background: #fffdf9;
}

select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    background: #fffdf9;
    color: var(--text);
}

input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: var(--brand);
}

select:focus,
textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: var(--brand);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button,
.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 0;
    padding: 14px 20px;
    font: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

button:hover,
.logout-link:hover {
    background: var(--brand-strong);
}

.logout-link {
    color: #fff;
    background: #3d342d;
}

.alert {
    border: 1px solid #f5c2c7;
    background: var(--danger-bg);
    color: var(--danger-text);
    border-radius: 14px;
    padding: 12px 14px;
}

.system-notices {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    width: min(720px, calc(100vw - 32px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.system-notices .alert {
    box-shadow: 0 12px 28px rgba(45, 36, 29, 0.16);
    pointer-events: auto;
}

.alert-success {
    border-color: #b7ebc6;
    background: #ebfff1;
    color: #17643a;
}

.alert-warning {
    border-color:#f0d58c;
    background:#fff8df;
    color:#6f5411;
}

.access-log-panel { display:grid; gap:24px; }
.access-log-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; }
.access-log-heading h2 { margin:5px 0 7px; }
.access-log-heading p { margin:0; color:#6c746f; }
.access-log-retention-note { flex:0 0 auto; padding:9px 13px; border:1px solid #d7e1d9; border-radius:999px; background:#f4f8f3; color:#315943; font-size:.76rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.access-log-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.access-log-summary-card { min-height:112px; padding:17px 18px; border:1px solid #dbe4dc; border-left:4px solid #2f7455; border-radius:15px; background:linear-gradient(145deg,#fff,#f5f8f4); display:flex; flex-direction:column; justify-content:center; }
.access-log-summary-card > span { color:#69736d; font-size:.76rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.access-log-summary-card > strong { margin:3px 0 1px; color:#1d3026; font-size:1.75rem; line-height:1.1; }
.access-log-summary-card > small { color:#828985; font-size:.75rem; }
.access-log-summary-card.is-alert { border-left-color:#d40000; }
.access-log-summary-card.is-alert > strong { color:#b60000; }
.access-log-filter-form { display:grid; grid-template-columns:minmax(240px,2fr) repeat(3,minmax(150px,1fr)) auto auto; gap:12px; align-items:stretch; padding:17px; border:1px solid #dce4dd; border-radius:16px; background:#f7f9f6; }
.access-log-field { position:relative; display:block; min-width:0; }
.access-log-field > span { position:absolute; z-index:2; top:-7px; left:12px; padding:0 6px; background:#f7f9f6; color:#bd0000; font-size:.67rem; font-weight:900; letter-spacing:.045em; line-height:1.2; text-transform:uppercase; pointer-events:none; }
.access-log-field input,.access-log-field select { width:100%; min-height:52px; border:1px solid #d3dbd5; border-radius:12px; background:#fff; color:#202923; padding:15px 13px 7px; font:inherit; }
.access-log-field input:focus,.access-log-field select:focus { border-color:#347455; outline:0; box-shadow:0 0 0 4px rgba(52,116,85,.11); }
.access-log-filter-form > button,.access-log-filter-form > .secondary-button { min-height:52px; align-self:stretch; display:inline-flex; align-items:center; justify-content:center; }
.access-log-table-wrap { overflow:auto; border:1px solid #dce4dd; border-radius:16px; }
.access-log-table { min-width:1120px; margin:0; }
.access-log-table th { white-space:nowrap; }
.access-log-table td { vertical-align:middle; }
.access-log-date,.access-log-ip { white-space:nowrap; font-variant-numeric:tabular-nums; }
.access-log-origin,.access-log-status { display:inline-flex; align-items:center; justify-content:center; min-height:28px; padding:5px 9px; border-radius:999px; font-size:.71rem; font-weight:900; letter-spacing:.035em; line-height:1; text-transform:uppercase; white-space:nowrap; }
.access-log-origin.is-customer { background:#edf6ef; color:#286044; }
.access-log-origin.is-platform { background:#eef1f5; color:#3f4e5a; }
.access-log-status.is-success { background:#e7f7ec; color:#17643a; }
.access-log-status.is-failed { background:#fff0f0; color:#b00000; }
.access-log-status.is-blocked { background:#fff5dc; color:#79580d; }
.access-log-identity strong,.access-log-detail span { display:block; }
.access-log-identity small,.access-log-detail small { display:block; margin-top:3px; color:#7b837e; font-size:.73rem; }
.access-log-detail { min-width:240px; }
.access-log-empty { min-height:150px; border:1px dashed #cbd9ce; border-radius:16px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; text-align:center; color:#68736d; }
.access-log-empty strong { color:#26342d; }

.email-history-panel { display:grid; gap:24px; }
.email-history-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; }
.email-history-heading h2 { margin:5px 0 7px; }
.email-history-heading p { margin:0; color:#6c746f; }
.email-history-count { flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; min-height:38px; padding:8px 14px; border:1px solid #d7e1d9; border-left:4px solid #2f7455; border-radius:999px; background:#f4f8f3; color:#315943; font-size:.78rem; font-weight:900; }
.email-history-filter-form { display:grid; grid-template-columns:minmax(300px,2fr) repeat(2,minmax(170px,1fr)) auto auto; gap:12px; align-items:stretch; padding:17px; border:1px solid #dce4dd; border-radius:16px; background:#f7f9f6; }
.email-history-filter-form > button,.email-history-filter-form > .secondary-button { min-height:52px; align-self:stretch; display:inline-flex; align-items:center; justify-content:center; }
.email-history-table-wrap { overflow:auto; border:1px solid #dce4dd; border-radius:16px; }
.users-permissions-table.email-history-table { min-width:1270px; margin:0; table-layout:fixed; }
.email-history-table .email-history-column-date { width:150px; }
.email-history-table .email-history-column-recipient { width:250px; }
.email-history-table .email-history-column-subject { width:320px; }
.email-history-table .email-history-column-actor { width:280px; }
.email-history-table .email-history-column-status { width:140px; }
.email-history-table .email-history-column-transport { width:130px; }
.users-permissions-table.email-history-table thead th,
.users-permissions-table.email-history-table tbody td { padding:14px 16px; text-align:left; vertical-align:middle; }
.users-permissions-table.email-history-table thead th { white-space:nowrap; }
.users-permissions-table.email-history-table th:first-child,
.users-permissions-table.email-history-table td:first-child,
.users-permissions-table.email-history-table th:nth-child(2),
.users-permissions-table.email-history-table td:nth-child(2) { width:auto; min-width:0; max-width:none; }
.users-permissions-table.email-history-table thead th:last-child,
.users-permissions-table.email-history-table tbody td:last-child { text-align:left; }
.email-history-date { white-space:nowrap; font-variant-numeric:tabular-nums; }
.email-history-recipient,.email-history-subject,.email-history-actor,.email-history-transport { min-width:0; }
.email-history-recipient strong,.email-history-subject strong,.email-history-actor strong,.email-history-transport strong { display:block; overflow-wrap:anywhere; }
.email-history-recipient small,.email-history-subject small,.email-history-actor small,.email-history-transport small { display:block; margin-top:4px; color:#747e78; font-size:.73rem; }
.email-history-subject { min-width:280px; }
.email-history-actor { min-width:220px; }
.email-history-origin,.email-history-status { display:inline-flex; align-items:center; justify-content:center; min-height:28px; margin-bottom:6px; padding:5px 9px; border-radius:999px; font-size:.69rem; font-weight:900; letter-spacing:.035em; line-height:1; text-transform:uppercase; white-space:nowrap; }
.email-history-origin.is-platform { background:#eef1f5; color:#3f4e5a; }
.email-history-origin.is-customer { background:#fff1df; color:#8a510d; }
.email-history-origin.is-system { background:#eef6ef; color:#286044; }
.email-history-status { margin:0; }
.email-history-status.is-sent { background:#e7f7ec; color:#17643a; }
.email-history-status.is-failed { background:#fff0f0; color:#b00000; }
.email-history-error { display:block; max-width:440px; margin-top:7px; color:#a30000; font-size:.75rem; line-height:1.4; overflow-wrap:anywhere; }
.email-history-pagination { display:flex; align-items:center; justify-content:space-between; gap:16px; color:#68736d; font-size:.84rem; font-weight:800; }
.email-history-pagination > div { display:flex; gap:10px; }
.email-history-pagination .secondary-button { min-height:42px; display:inline-flex; align-items:center; justify-content:center; }

@media (max-width:1180px) {
    .access-log-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .access-log-filter-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .access-log-search-field { grid-column:1/-1; }
    .email-history-filter-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .email-history-search-field { grid-column:1/-1; }
}

@media (max-width:680px) {
    .access-log-heading { display:grid; }
    .access-log-retention-note { justify-self:start; }
    .access-log-summary,.access-log-filter-form { grid-template-columns:1fr; }
    .access-log-search-field { grid-column:auto; }
    .email-history-heading { display:grid; }
    .email-history-count { justify-self:start; }
    .email-history-filter-form { grid-template-columns:1fr; }
    .email-history-search-field { grid-column:auto; }
    .email-history-pagination { align-items:flex-start; flex-direction:column; }
}

.auto-dismiss-success {
    transition: opacity 160ms var(--motion-ease-in), transform 160ms var(--motion-ease-in), filter 160ms var(--motion-ease-in);
}

.auto-dismiss-success.is-fading-out {
    opacity: 0;
    transform: translateY(-8px);
}

code {
    font-family: "Courier New", monospace;
}

.payment-form {
    display: grid;
    gap: 12px;
}

.admin-launch-panel,
.admin-list-panel {
    width: 100%;
    min-width: 0;
}

.admin-launch-header {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.admin-launch-header h2 {
    margin-bottom: 0;
}

.admin-launch-header p {
    margin-bottom: 0;
}

.admin-launch-collapsible {
    display: grid;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.admin-launch-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style: none;
    width: 100%;
}

.admin-launch-summary::-webkit-details-marker {
    display: none;
}

.admin-launch-summary h2 {
    margin-bottom: 0;
}

.admin-launch-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    color: var(--muted);
}

.admin-launch-toggle::before {
    content: "▾";
    font-size: 1rem;
    line-height: 1;
    transition: transform 180ms var(--motion-ease-out);
}

.admin-launch-collapsible:not([open]) .admin-launch-toggle::before {
    transform: rotate(-90deg);
}

.admin-launch-content {
    display: grid;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.admin-launch-form {
    display: grid;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.analysis-assistant {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px dashed rgba(15, 118, 110, 0.35);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.65));
    width: 100%;
    min-width: 0;
}

.analysis-assistant-top {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.analysis-assistant-top .analysis-dropzone {
    grid-column: 1 / span 3;
}

.analysis-assistant-top .analysis-preview-button {
    grid-column: 4;
}

.analysis-dropzone {
    display: grid;
    gap: 4px;
    min-height: 92px;
    padding: 18px 20px;
    border: 1px dashed rgba(15, 118, 110, 0.45);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    cursor: pointer;
    transition: border-color 180ms var(--motion-ease-out), background-color 180ms var(--motion-ease-out), transform 180ms var(--motion-ease-out), box-shadow 180ms var(--motion-ease-out);
    min-width: 0;
}

.analysis-dropzone:hover,
.analysis-dropzone.is-dragover {
    border-color: var(--brand);
    background: #f1fbf8;
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.analysis-dropzone.is-analyzing {
    border-color: var(--brand-strong);
    background: #edf8f6;
}

.analysis-dropzone.is-disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.analysis-dropzone-title {
    color: var(--text);
    font-weight: 700;
}

.analysis-dropzone-text {
    color: var(--muted);
    line-height: 1.5;
}

.analysis-feedback {
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0.96rem;
}

.analysis-progress {
    flex: 1 1 auto;
    min-width: 160px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #8bd6c8 0%, #0f766e 100%);
    overflow: hidden;
}

.analysis-progress-bar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: rgba(255, 250, 244, 0.92);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    transform: scaleX(1);
    transform-origin: right center;
    transition: transform 220ms var(--motion-ease-out);
    margin-left: auto;
}

.analysis-progress.is-complete .analysis-progress-bar {
    box-shadow: none;
}

.analysis-feedback.is-info {
    background: #edf8f6;
    color: #14564f;
    border: 1px solid rgba(15, 118, 110, 0.18);
}

.analysis-feedback.is-success {
    background: #ebfff1;
    color: #17643a;
    border: 1px solid #b7ebc6;
}

.analysis-feedback.is-warning,
.analysis-feedback.is-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid #f5c2c7;
}

.bulk-import-panel {
    display: grid;
    gap: 14px;
    margin: 14px 0 20px;
    padding: 16px 18px;
    border: 1px dashed rgba(15, 118, 110, 0.35);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
}

.bulk-import-header h3 {
    margin: 0 0 4px;
}

.bulk-import-header p {
    margin: 0;
    color: var(--muted);
}

.bulk-import-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bulk-import-controls input[type="file"] {
    flex: 1 1 280px;
    min-width: 240px;
}

.bulk-import-start {
    min-width: 180px;
    height: 48px;
    padding: 0 18px;
    border-radius: 16px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    border: 0;
    cursor: pointer;
}

.bulk-import-results {
    display: grid;
    gap: 10px;
}

.bulk-import-list {
    display: grid;
    gap: 10px;
}

.bulk-import-item {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffdf9;
    transition: opacity 160ms var(--motion-ease-in), transform 160ms var(--motion-ease-in), filter 160ms var(--motion-ease-in);
}

.bulk-import-item.is-fading-out {
    opacity: 0;
    transform: translateY(-8px);
}

.bulk-import-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bulk-import-status {
    font-weight: 700;
    color: var(--muted);
}

.bulk-import-status.is-success {
    color: var(--brand);
}

.bulk-import-status.is-warning {
    color: #9b5a00;
}

.bulk-import-status.is-error {
    color: #8b2c2c;
}

.bulk-import-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.bulk-import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 6px;
}

.bulk-import-actions button {
    min-width: 110px;
}

.bulk-import-pending h4 {
    margin: 4px 0 8px;
}

.pending-list {
    display: grid;
    gap: 10px;
}

.pending-item {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffdf9;
}

.pending-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--muted);
}

.pending-meta strong {
    color: var(--text);
}

.pending-meta em {
    color: #9b5a00;
    font-style: normal;
    font-weight: 700;
}

.pending-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.pending-actions button {
    min-width: 120px;
}

.managed-user-item .pending-actions {
    justify-content: flex-start;
    margin-top: 4px;
}

.pending-file-indicator {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px dashed rgba(15, 118, 110, 0.32);
    border-radius: 12px;
    background: rgba(15, 118, 110, 0.06);
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

.analysis-suggestions {
    display: grid;
    gap: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    width: 100%;
    min-width: 0;
}

.analysis-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.analysis-suggestions-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.analysis-suggestion-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid rgba(220, 207, 190, 0.9);
    border-radius: 14px;
    background: #fffdf9;
}

.analysis-suggestion-label {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.analysis-suggestion-value {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.4;
}

.analysis-confidence {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    background: #f4e8e8;
    color: #8b2c2c;
}

.analysis-confidence[data-level="high"] {
    background: #e7f8ef;
    color: #17643a;
}

.analysis-confidence[data-level="medium"] {
    background: #fff6dc;
    color: #8a5a00;
}

.analysis-apply-button {
    width: 180px;
    min-width: 180px;
    height: 56px;
    padding: 0 18px;
    border-radius: 16px;
    justify-self: end;
}

.analysis-apply-button:disabled {
    background: #8f8479;
    color: #fff;
    cursor: not-allowed;
}

.analysis-apply-button:disabled:hover {
    background: #8f8479;
}

.admin-launch-grid {
    display: grid;
    grid-template-columns: 150px 150px minmax(220px, 1fr) minmax(220px, 0.95fr) 120px 130px 130px;
    column-gap: 12px;
    row-gap: 12px;
    align-items: end;
    width: 100%;
    min-width: 0;
}

.dashboard-page.area-fornecedores .admin-launch-grid {
    grid-template-columns: 150px 150px minmax(230px, 1fr) minmax(220px, 0.9fr) 120px 128px 128px;
    column-gap: 14px;
    row-gap: 16px;
}

.form-field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.form-field small {
    color: var(--muted);
    line-height: 1.4;
}

.user-settings-fields .form-field small {
    white-space: nowrap;
}

.form-field-date,
.form-field-fornecedor,
.form-field-nome-fornecedor,
.form-field-valor {
    grid-row: 1;
}

.form-field-date {
    grid-column: 1;
}

.form-field-fornecedor {
    grid-column: 2;
}

.form-field-nome-fornecedor {
    grid-column: 3;
}

.form-field-documento {
    grid-column: 4;
    grid-row: 1;
}

.form-field-valor {
    grid-column: 5;
    grid-row: 1;
}

.form-field-pdf {
    grid-column: 4 / span 3;
    grid-row: 2;
}

.form-field-submit {
    grid-column: 6 / span 2;
    grid-row: 2;
    align-self: start;
    display: grid;
    grid-template-rows: 30px minmax(56px, auto);
    justify-content: stretch;
}

.form-field-submit::before {
    content: "";
    display: block;
}

.form-field-submit button {
    height: 56px;
    min-height: 56px;
    padding: 0 18px;
    border-radius: 16px;
}

.form-field-valor input {
    max-width: 120px;
    justify-self: start;
}

.ai-settings-form {
    display: grid;
    gap: 16px;
}

.ai-settings-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1.3fr) 124px minmax(240px, 0.9fr) minmax(240px, 0.9fr);
    column-gap: 14px;
    row-gap: 14px;
    align-items: start;
}

.ai-settings-field-wide,
.ai-settings-actions {
    grid-column: 1 / -1;
}

.ai-api-test-field {
    grid-column: 2;
    grid-row: 1;
}

.ai-model-field {
    grid-column: 3;
    grid-row: 1;
}

.ai-mode-field {
    grid-column: 4;
    grid-row: 1;
}

.ai-api-key-field,
.ai-model-field,
.ai-mode-field,
.ai-api-test-field {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.ai-api-key-field input,
.ai-model-field select,
.ai-mode-field select {
    height: 46px;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fffdf9;
}

.ai-api-test-field button {
    width: 100%;
    height: 46px;
    min-width: 0;
    padding: 0 14px;
    border-radius: 10px;
    background: #3d342d;
    color: #fff;
}

.ai-api-test-field button:hover {
    background: var(--brand-strong);
}

.ai-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-settings-actions button {
    min-width: 240px;
}

.email-settings-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
    gap: 22px;
    align-items: start;
}

.email-test-result {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 20px;
    overflow-wrap: anywhere;
    box-shadow: 0 12px 28px rgba(45, 36, 29, 0.12);
}

.email-test-result strong {
    color: inherit;
    font-size: 0.95rem;
}

.email-test-result p {
    margin: 0;
    color: inherit;
    font-size: 0.84rem;
    line-height: 1.5;
}

.auto-dismiss-notice {
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease-in),
        transform var(--motion-duration-fast) var(--motion-ease-in),
        filter var(--motion-duration-fast) var(--motion-ease-in);
}

.auto-dismiss-notice.is-fading-out {
    opacity: 0;
    transform: translateY(-6px);
    filter: blur(1px);
}

@media (max-width: 980px) {
    .email-settings-workspace {
        grid-template-columns: 1fr;
    }
}

.api-test-status {
    display: inline-flex;
    width: fit-content;
    min-height: 0;
    align-items: center;
    margin-top: 2px;
    padding: 0;
    border-radius: 0;
    font-size: 0.88rem;
    line-height: 1.35;
    background: transparent;
}

.api-test-status.is-success {
    color: #17643a;
}

.api-test-status.is-warning {
    color: #9b5a00;
}

.api-test-status.is-error {
    color: var(--danger-text);
}

.sms-env-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.sms-env-header h2 {
    margin-bottom: 2px;
}

.sms-env-header p {
    margin-bottom: 0;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sms-config-badge {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 800;
    color: #8a5a00;
    background: #fff6dc;
}

.sms-config-badge.is-ok {
    color: #17643a;
    background: #e7f8ef;
}

.sms-config-badge.is-missing {
    color: var(--danger-text);
    background: #fff0f0;
}

.sms-env-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.sms-env-summary div {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf9;
}

.sms-env-summary span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sms-env-summary strong {
    display: block;
    margin-top: 4px;
}

.sms-provider-settings-form {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.sms-provider-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.sms-provider-card {
    position: relative;
    min-width: 0;
    margin: 0;
    padding: 18px;
    overflow: hidden;
    border: 1px solid #d8dfda;
    border-radius: 18px;
    background: #fffdfa;
    box-shadow:
        0 0 0 1px rgba(28, 58, 45, 0.02),
        0 4px 14px rgba(28, 58, 45, 0.045);
}

.sms-provider-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, rgba(31, 112, 82, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-duration-fast) var(--motion-ease-out);
}

.sms-provider-card.is-selected {
    border-color: #5c9d82;
    box-shadow:
        inset 4px 0 0 #216d50,
        0 0 0 1px rgba(33, 109, 80, 0.06),
        0 12px 30px rgba(28, 88, 65, 0.1);
}

.sms-provider-card.is-selected::before {
    opacity: 1;
}

.sms-provider-card > * {
    position: relative;
    z-index: 1;
}

.sms-provider-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sms-provider-choice {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    cursor: pointer;
}

.sms-provider-choice input[type="checkbox"] {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #216d50;
}

.sms-provider-choice > span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.sms-provider-choice strong {
    color: #17241f;
    font-size: 1.2rem;
}

.sms-provider-choice small,
.sms-provider-source {
    color: #6c746f;
    font-size: 0.76rem;
    line-height: 1.4;
}

.sms-provider-state {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 850;
    white-space: nowrap;
}

.sms-provider-state.is-configured {
    color: #17643a;
    background: #e4f6eb;
}

.sms-provider-state.is-incomplete {
    color: #9b5a00;
    background: #fff3d2;
}

.sms-provider-source {
    margin: 14px 0 12px;
}

.sms-provider-source strong {
    color: #405048;
}

.sms-provider-callback {
    display: grid;
    gap: 5px;
    margin-top: 13px;
    padding: 11px 13px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(31, 80, 61, 0.1);
}

.sms-provider-callback > span,
.sms-provider-callback-header > span {
    color: #68736d;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.sms-provider-callback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sms-provider-callback-copy {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 14px;
    border: 1px solid #216d50;
    border-radius: 999px;
    color: #ffffff;
    background: #216d50;
    box-shadow: 0 4px 12px rgba(33, 109, 80, 0.14);
    font-size: 0.72rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
    transition:
        background-color var(--motion-duration-fast) var(--motion-ease-out),
        box-shadow var(--motion-duration-fast) var(--motion-ease-out);
}

.sms-provider-callback-copy:hover {
    border-color: #174f3a;
    background: #174f3a;
    box-shadow: 0 6px 16px rgba(33, 109, 80, 0.2);
}

.sms-provider-callback-copy:focus-visible {
    outline: 3px solid rgba(33, 109, 80, 0.24);
    outline-offset: 2px;
}

.sms-provider-callback code {
    display: block;
    overflow: hidden;
    color: #214f45;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sms-provider-callback small {
    color: #707a74;
    font-size: 0.7rem;
}

.sms-provider-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sms-provider-fields input,
.sms-provider-fields select {
    min-height: 50px;
    border-radius: 11px;
}

.sms-provider-settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 17px;
    border-radius: 14px;
    background: #f2f6f2;
}

.sms-provider-settings-footer p {
    margin: 0;
    color: #657069;
    font-size: 0.8rem;
    line-height: 1.45;
}

.sms-provider-settings-footer button {
    flex: 0 0 auto;
    min-width: 230px;
}

.sms-provider-settings-form.is-keyboard-change .sms-provider-card::before {
    transition: none;
}

@media (max-width: 1180px) {
    .sms-provider-grid,
    .sms-test-row {
        grid-template-columns: 1fr;
    }
}

.sms-test-row {
    display: grid;
    grid-template-columns: minmax(380px, 470px) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
    margin-top: 18px;
}

.sms-balance-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
}

.sms-provider-dependent {
    opacity: 1;
    transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sms-provider-dependent.is-provider-switching {
    opacity: 0.58;
}

.sms-balance-card[hidden],
.sms-history-main-row[hidden],
.sms-history-detail-row[hidden],
.sms-history-wrap[hidden],
[data-sms-history-empty][hidden] {
    display: none !important;
}

.sms-test-form {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.5fr) auto;
    gap: 14px;
    align-items: end;
    min-width: 0;
}

.sms-test-form input {
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 10px;
}

.sms-test-actions button {
    height: 46px;
    min-width: 150px;
}

.sms-management-panel {
    display: grid;
    gap: 18px;
}

.sms-management-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.sms-management-header h2 {
    margin-bottom: 2px;
}

.sms-management-header p {
    margin-bottom: 0;
}

.sms-search-form {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 48px auto;
    gap: 10px;
    align-items: end;
}

.sms-search-form label {
    grid-column: 1 / -1;
    margin-bottom: -4px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sms-search-form input {
    height: 48px;
}

.sms-send-form {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.5fr) auto;
    gap: 14px;
    align-items: end;
}

.sms-message-field small {
    display: block;
}

.sms-send-actions button {
    height: 48px;
    min-width: 150px;
}

.sms-history-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.sms-history-header h2 {
    margin: 5px 0 7px;
}

.sms-history-header p {
    margin: 0;
    color: #6c746f;
}

.sms-history-heading-copy {
    min-width: 0;
}

.sms-history-provider-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e6f3ec;
    color: #1c6849;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
    vertical-align: middle;
}

.sms-history-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-width: min(100%, 440px);
}

.sms-history-refresh-form {
    flex: 0 0 auto;
}

.sms-history-refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 112px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #216d50;
    border-radius: 999px;
    color: #ffffff;
    background: #216d50;
    box-shadow: 0 7px 18px rgba(33, 109, 80, 0.16);
    font-size: 0.78rem;
    font-weight: 850;
    white-space: nowrap;
    transition:
        background-color var(--motion-duration-fast) var(--motion-ease-out),
        box-shadow var(--motion-duration-fast) var(--motion-ease-out),
        opacity var(--motion-duration-fast) var(--motion-ease-out);
}

.sms-history-refresh-button:hover:not(:disabled) {
    border-color: #174f3a;
    background: #174f3a;
    box-shadow: 0 9px 22px rgba(33, 109, 80, 0.22);
}

.sms-history-refresh-button:focus-visible {
    outline: 3px solid rgba(33, 109, 80, 0.24);
    outline-offset: 2px;
}

.sms-history-refresh-button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.sms-history-refresh-button > span:first-child {
    font-size: 1rem;
    line-height: 1;
}

.sms-balance-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 74px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #4b4741, #2f2c28);
    box-shadow: 0 12px 26px rgba(35, 32, 28, 0.16);
}

.sms-balance-card.is-available {
    border-color: rgba(255, 255, 255, 0.16);
    background: linear-gradient(135deg, #214f45, #0f766e);
    box-shadow: 0 12px 28px rgba(20, 92, 79, 0.22);
}

.sms-balance-card.is-default {
    box-shadow:
        0 0 0 2px rgba(240, 170, 18, 0.52),
        0 12px 28px rgba(20, 92, 79, 0.22);
}

.sms-balance-card span,
.sms-balance-card small {
    color: rgba(255, 255, 255, 0.76);
    line-height: 1.2;
}

.sms-balance-card span {
    font-size: 0.67rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sms-balance-card strong {
    color: #fff;
    font-size: 1.08rem;
}

.sms-balance-card small {
    font-size: 0.68rem;
}

.sms-history-search-form {
    display: flex;
    align-items: center;
    align-self: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: min(100%, 440px);
}

.sms-history-search-form .floating-search {
    position: relative;
    display: block;
    width: min(360px, 100%);
}

.sms-history-search-form .floating-search span {
    position: absolute;
    top: -8px;
    left: 14px;
    padding: 0 6px;
    background: #fffaf4;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.sms-history-search-form input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf9;
    color: var(--text);
    padding: 0 14px;
    font: inherit;
}

.sms-history-wrap {
    overflow-x: auto;
}

.sms-history-table {
    min-width: 860px;
    table-layout: fixed;
}

.sms-history-table th,
.sms-history-table td {
    text-align: left;
    vertical-align: middle;
}

.sms-history-table th:first-child,
.sms-history-table td:first-child {
    width: 150px;
    max-width: none;
}

.sms-history-table th:nth-child(2),
.sms-history-table td:nth-child(2) {
    width: 120px;
    max-width: none;
}

.sms-history-table th:nth-child(3),
.sms-history-table td:nth-child(3) {
    width: auto;
}

.sms-history-table th:nth-child(4),
.sms-history-table td:nth-child(4) {
    width: 92px;
    text-align: center;
}

.sms-credit-source {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
}

.sms-history-table th:last-child,
.sms-history-table td:last-child {
    width: 128px;
    text-align: left;
}

.sms-history-main-row {
    cursor: pointer;
}

.sms-history-main-row:hover {
    background: rgba(13, 127, 118, 0.04);
}

.sms-history-main-row:focus-visible {
    outline: 3px solid rgba(13, 127, 118, 0.22);
    outline-offset: -3px;
}

.sms-history-detail-row > td {
    padding: 0 0 14px;
    background: #fff8ef;
}

.sms-history-detail-grid {
    display: grid;
    gap: 12px;
    margin: 0 12px;
    padding: 14px 16px 16px;
    border: 1px solid rgba(214, 197, 177, 0.78);
    border-radius: 10px;
    background: #fffdf9;
}

.sms-history-meta-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 10px;
}

.sms-history-meta-grid > div,
.sms-history-message-detail,
.sms-history-error-detail {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(214, 197, 177, 0.62);
    border-radius: 8px;
    background: rgba(250, 246, 240, 0.55);
}

.sms-history-detail-grid span,
.sms-history-message-detail span,
.sms-history-error-detail span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.sms-history-detail-grid strong,
.sms-history-detail-grid p {
    margin: 0;
    overflow-wrap: anywhere;
}

.sms-history-message-detail p {
    color: var(--text);
    line-height: 1.45;
    white-space: normal;
}

.sms-history-error-detail strong {
    color: var(--danger-text);
}

.sms-history-table td span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.sms-status-ok {
    color: #17643a;
}

.sms-status-error {
    color: var(--danger-text);
}

.sms-status-progress {
    color: #8b6614;
}

.settings-users-layout {
    display: grid;
    gap: 18px;
}

.user-settings-form {
    display: grid;
    gap: 16px;
}

.user-settings-top {
    display: grid;
    grid-template-columns: minmax(280px, 30%) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.user-settings-fields {
    display: grid;
    gap: 16px;
}

.user-settings-permissions-table-wrap {
    overflow-x: auto;
}

.settings-permissions {
    display: grid;
    gap: 10px;
}

.settings-permissions label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.settings-permissions input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.users-table-wrap {
    margin-left: 0;
    padding: 0;
    border-left: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow-x: auto;
}

.users-permissions-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 920px;
    table-layout: fixed;
}

.users-permissions-table th,
.users-permissions-table td {
    padding: 8px 6px;
    border-bottom: 1px solid rgba(184, 145, 96, 0.24);
    vertical-align: middle;
}

.users-permissions-table thead th {
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
}

.users-permissions-table thead th[rowspan] {
    text-align: left;
}

.users-permissions-table-compact thead th[rowspan],
.users-permissions-table thead tr:first-child th[rowspan]:nth-child(n+3) {
    text-align: center;
}

.users-permissions-table .users-permission-unavailable {
    background: #f0f1ef;
    color: #999e9b;
}

.users-permissions-table .users-permission-unavailable input[type="checkbox"] {
    opacity: 0.52;
    accent-color: #9da29f;
    cursor: not-allowed;
}

.users-permissions-table thead th:last-child,
.users-permissions-table td:last-child {
    text-align: center;
}

.users-permissions-table th:first-child,
.users-permissions-table td:first-child,
.users-permissions-table th:nth-child(2),
.users-permissions-table td:nth-child(2) {
    width: 17ch;
    min-width: 17ch;
    max-width: 17ch;
}

.users-permissions-table tbody tr:last-child td {
    border-bottom: 0;
}

.users-permissions-table-compact {
    min-width: 0;
}

.users-permissions-table-compact th,
.users-permissions-table-compact td {
    padding: 10px 8px;
}

.users-permissions-table-compact th:first-child,
.users-permissions-table-compact td:first-child,
.users-permissions-table-compact th:nth-child(2),
.users-permissions-table-compact td:nth-child(2) {
    width: auto;
    min-width: 0;
    max-width: none;
}

.users-permissions-table td input[type="text"],
.users-permissions-table td input[type="email"],
.users-permissions-table td input[type="password"] {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
}

.users-permissions-table td:first-child input[type="text"],
.users-permissions-table td:nth-child(2) input[type="email"] {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-weight: 600;
}

.users-permissions-table td:first-child input[type="text"]:focus,
.users-permissions-table td:nth-child(2) input[type="email"]:focus {
    outline: none;
    border: 0;
    box-shadow: none;
}

.users-permissions-check {
    text-align: center;
    width: 52px;
}

.users-permissions-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.users-table-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
}

.settings-users-layout .users-table-actions button {
    min-width: auto;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    background-image: none;
    box-shadow: none;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    transform: none;
    scale: 1;
    transition: none;
}

.settings-users-layout .users-table-actions button:hover,
.settings-users-layout .users-table-actions button:active {
    background: transparent;
    background-image: none;
    box-shadow: none;
    color: inherit;
    transform: none;
    scale: 1;
}

.settings-users-layout .users-table-actions button:focus-visible {
    outline: 2px solid var(--magi-green);
    outline-offset: 3px;
    border-radius: 3px;
    background: transparent;
    background-image: none;
    box-shadow: none;
}

.users-table-actions .secondary-button {
    color: #d64d63;
}

.users-row-form {
    display: none;
}

.admin-submit-actions {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 12px;
    min-height: 56px;
}

.dashboard-page.area-fornecedores .admin-submit-actions {
    gap: 14px;
}

.admin-submit-actions button {
    width: 130px;
    min-width: 130px;
}

.dashboard-page.area-fornecedores .admin-submit-actions button {
    width: 128px;
    min-width: 128px;
}

.dashboard-page.area-fornecedores .form-field-documento input {
    min-width: 0;
}

.dashboard-page.area-fornecedores .supplier-upload-field .file-upload {
    min-height: 64px;
}

.dashboard-page.area-fornecedores .supplier-upload-field .file-upload-button {
    min-width: 156px;
}

.dashboard-page.area-fornecedores .form-field-date input[type="date"] {
    width: 100%;
    min-width: 0;
    padding-right: 34px;
    letter-spacing: 0.01em;
}

.dashboard-page.area-fornecedores .form-field-date input[type="date"]::-webkit-datetime-edit {
    padding-right: 2px;
}

.dashboard-page.area-fornecedores .form-field-date input[type="date"]::-webkit-calendar-picker-indicator {
    margin-left: 6px;
    opacity: 0.9;
}

.dashboard-page.area-pagamentos .form-field-date input[type="date"] {
    width: 100%;
    min-width: 0;
    padding-right: 34px;
    letter-spacing: 0.01em;
}

.dashboard-page.area-pagamentos .form-field-date input[type="date"]::-webkit-datetime-edit {
    padding-right: 2px;
}

.dashboard-page.area-pagamentos .form-field-date input[type="date"]::-webkit-calendar-picker-indicator {
    margin-left: 6px;
    opacity: 0.9;
}

.supplier-form-layout {
    display: grid;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.payment-form-layout {
    display: grid;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.supplier-fields-row {
    display: grid;
    grid-template-columns: 150px 150px 280px 280px 120px;
    gap: 9px;
    align-items: end;
    width: 100%;
    min-width: 0;
    justify-content: start;
}

.payment-fields-row {
    display: grid;
    grid-template-columns: 165px 340px 266px 112px;
    gap: 9px;
    align-items: end;
    width: 100%;
    min-width: 0;
    justify-content: start;
}

.supplier-upload-actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 266px;
    align-items: end;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.payment-upload-actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 266px;
    align-items: end;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.supplier-upload-field {
    min-width: 0;
}

.payment-upload-field {
    min-width: 0;
}

.supplier-submit-field {
    width: 266px;
    min-width: 266px;
}

.payment-submit-field {
    width: 266px;
    min-width: 266px;
}

.supplier-submit-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-left: auto;
    flex-wrap: nowrap;
    gap: 10px;
}

.payment-submit-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-left: auto;
    flex-wrap: nowrap;
    gap: 10px;
}

.dashboard-page.area-fornecedores .supplier-upload-field .file-upload {
    padding-right: 18px;
}

.payment-upload-field .file-upload {
    min-height: 64px;
    padding-right: 18px;
}

.dashboard-page.area-fornecedores .supplier-submit-actions button {
    width: 128px;
    min-width: 128px;
}

.payment-submit-actions button {
    width: 128px;
    min-width: 128px;
}

/* Layout previously expressed through inline styles. Keeping it in the
   stylesheet allows a strict CSP without changing the desktop arrangement. */
.inline-field-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    width: 100%;
}

.inline-field-row .fixed-field-165 { flex: 0 0 165px; }
.inline-field-row .fixed-field-136 { flex: 0 0 136px; }
.inline-field-row .fixed-field-340 { flex: 0 0 340px; }
.inline-field-row .fixed-field-266 { flex: 0 0 266px; }
.inline-field-row .fixed-field-420 { flex: 0 0 420px; }
.inline-field-row .fixed-field-320 { flex: 0 0 320px; }
.inline-field-row .fixed-field-112 { flex: 0 0 112px; }

.inline-upload-actions-row {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.upload-flex-field {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 284px);
}

.file-upload-compact {
    min-height: 64px;
    padding-right: 18px;
}

.submit-fixed-field {
    flex: 0 0 266px;
    width: 266px;
    min-width: 266px;
}

.inline-submit-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-left: auto;
    flex-wrap: nowrap;
}

.submit-fixed-button {
    width: 128px;
    min-width: 128px;
}

.admin-launch-panel .form-field-pdf {
    grid-column: 1 / span 5;
    grid-row: 2;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffdf9;
    cursor: pointer;
    transition: border-color 180ms var(--motion-ease-out), background-color 180ms var(--motion-ease-out), box-shadow 180ms var(--motion-ease-out);
    min-width: 0;
}

.file-upload.is-dragover {
    border-color: var(--brand);
    background: #f1fbf8;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.file-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #a8a09a;
    border-radius: 10px;
    background: #f3ede4;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.file-upload-text {
    color: var(--muted);
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-clear {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    background: #8b2c2c;
    color: #fff;
    font-weight: 700;
}

.file-upload-clear:hover {
    background: #6f1f1f;
}

.file-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.analysis-preview-button {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 92px;
    border-radius: 16px;
    justify-self: stretch;
}

.analysis-preview-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #8f8479;
}

.payments-groups {
    display: grid;
    gap: 20px;
}

.payments-group h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-strong);
}

.payments-list {
    display: grid;
    gap: 12px;
}

.payment-item {
    width: 100%;
    text-align: left;
    background: #fffdf9;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px 18px;
    display: grid;
    gap: 6px;
}

.payment-item:hover {
    border-color: var(--brand);
    transform: translateY(-1px);
}

.payment-main {
    display: grid;
    gap: 6px;
}

.payment-title {
    font-weight: 700;
}

.payment-meta {
    color: var(--muted);
}

.delete-form {
    margin-top: -4px;
}

.inline-delete-form {
    margin: 0;
}

.delete-button {
    width: 100%;
    cursor: pointer;
    background: #8b2c2c;
    color: #fff;
    font-weight: 700;
}

.delete-button:hover {
    background: #6f1f1f;
}

.mini-delete-button {
    width: auto;
    min-width: 110px;
    padding: 10px 14px;
    background: #8b2c2c;
    color: #fff;
    font-weight: 700;
    border-radius: 12px;
}

.mini-delete-button:hover {
    background: #6f1f1f;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.icon-action-button {
    width: auto;
    min-width: 0;
    height: auto;
    padding: 0;
    border-radius: 0;
    font-size: 1.05rem;
    text-decoration: none;
    background: transparent;
}

.action-view {
    color: var(--brand-strong);
}

.action-view:hover {
    background: transparent;
}

.action-edit {
    color: #3d342d;
}

.action-edit:hover {
    background: transparent;
}

.action-email {
    color: #0f766e;
}

.action-email:hover,
.action-email:focus-visible {
    background: transparent;
    transform: translateY(-1px);
}

.action-delete {
    color: #b91c1c;
}

.action-delete:hover {
    background: transparent;
}

.supplier-date-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.supplier-date-cell > span {
    display: inline-flex;
    align-items: center;
}

.supplier-email-select {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}

.supplier-bulk-email-button {
    border: 0;
    cursor: pointer;
    color: var(--brand-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 1.08rem;
    line-height: 1;
}

.supplier-bulk-email-button:hover,
.supplier-bulk-email-button:focus-visible {
    background: #2f261f;
    color: #fff;
}

.archive-toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 12px;
}

.archive-heading {
    min-width: 0;
}

.archive-toolbar h2 {
    margin-bottom: 0;
    flex: 0 0 auto;
}

.admin-list-toolbar {
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.archive-search {
    display: grid;
    gap: 10px;
    justify-items: end;
    width: 470px;
    max-width: 100%;
    flex: 0 0 470px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 249, 0.82);
}

.archive-search-inline {
    width: min(100%, 1000px);
    max-width: 100%;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 48px 1fr;
    align-items: center;
    gap: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.admin-search-inline {
    width: auto;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.archive-search-fields {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.admin-search-fields {
    gap: 10px;
    flex-wrap: wrap;
}

.search-reset {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #3d342d;
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
}

.search-reset:hover {
    background: #2e2722;
}

.search-strip {
    display: flex;
    justify-content: flex-end;
    margin-top: -8px;
    margin-bottom: 4px;
}

.archive-search-row {
    width: 100%;
}

.archive-search-row-top {
    display: grid;
    grid-template-columns: 190px 48px;
    justify-content: end;
    gap: 10px;
    align-items: center;
}

.archive-search-row-text {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px;
    align-items: center;
}

.admin-search-fields .archive-search-row-text {
    width: 300px;
    max-width: 300px;
}

.admin-search-fields .archive-search-row-top {
    width: 210px;
    max-width: 210px;
    grid-template-columns: 1fr 48px;
}

.admin-search-fields .archive-search-row-text {
    width: 320px;
    max-width: 320px;
}

.admin-search-fields .archive-search-row-top {
    width: 240px;
    max-width: 240px;
    grid-template-columns: 1fr 48px;
}

.archive-search input {
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff;
}

.archive-search input[type="date"] {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
}

.search-button {
    width: 48px !important;
    min-width: 48px;
    max-width: 48px;
    height: 48px;
    padding: 0 !important;
    flex: 0 0 48px;
    justify-self: end;
    align-self: center;
    display: inline-flex;
    background: #3d342d;
    color: #fff;
    font-weight: 700;
    border-radius: 12px;
}

.search-button:hover {
    background: #2e2722;
}

.archive-tree {
    display: grid;
    gap: 18px;
}

.tree-year,
.tree-month {
    border: 0;
    background: transparent;
}

.tree-year > summary,
.tree-month > summary {
    cursor: pointer;
    list-style: none;
    padding: 6px 0;
    font-weight: 700;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-year > summary::-webkit-details-marker,
.tree-month > summary::-webkit-details-marker {
    display: none;
}

.tree-year > summary::before,
.tree-month > summary::before {
    content: "▸";
    display: inline-block;
    width: 14px;
    color: var(--muted);
    transition: transform 150ms var(--motion-ease-out);
}

.tree-year[open] > summary::before,
.tree-month[open] > summary::before {
    transform: rotate(90deg);
}

.tree-year > summary::after,
.tree-month > summary::after {
    content: "📁";
    font-size: 0.95rem;
}

.tree-label {
    color: var(--text);
}

.tree-months {
    margin-left: 26px;
    padding: 4px 0 0 10px;
    display: grid;
    gap: 12px;
    border-left: 1px solid var(--line);
}

.simple-list {
    margin-left: 26px;
    padding: 8px 0 8px 10px;
    border-left: 1px dashed var(--line);
    background: #fffdf9;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.simple-table th,
.simple-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

.simple-table thead th {
    font-weight: 700;
    color: var(--text);
    background: rgba(220, 207, 190, 0.18);
}

.simple-table tbody td {
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.simple-table th:nth-child(1),
.simple-table td:nth-child(1) {
    width: 11ch;
    white-space: nowrap;
}

.simple-table.fornecedores-table th:nth-child(3),
.simple-table.fornecedores-table td:nth-child(3) {
    width: auto;
    text-align: left;
    white-space: normal;
}

.simple-table.fornecedores-table th:nth-child(4),
.simple-table.fornecedores-table td:nth-child(4) {
    width: 16ch;
    white-space: nowrap;
}

.simple-table.fornecedores-table th:nth-child(5),
.simple-table.fornecedores-table td:nth-child(5) {
    width: 11ch;
    white-space: nowrap;
    text-align: right;
}

.simple-table.fornecedores-table th:last-child,
.simple-table.fornecedores-table td:last-child {
    width: 104px;
}

.simple-table.pagamentos-table th:nth-child(2),
.simple-table.pagamentos-table td:nth-child(2) {
    width: 250px;
    min-width: 250px;
    white-space: normal;
}

.simple-table.pagamentos-table th:nth-child(3),
.simple-table.pagamentos-table td:nth-child(3) {
    width: 18ch;
    min-width: 18ch;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.simple-table.pagamentos-table th:nth-child(4),
.simple-table.pagamentos-table td:nth-child(4) {
    width: 13ch;
    min-width: 13ch;
    white-space: nowrap;
    text-align: right;
}

.simple-table.pagamentos-table th:nth-child(1),
.simple-table.pagamentos-table td:nth-child(1) {
    width: 11ch;
    min-width: 11ch;
    white-space: nowrap;
}

.simple-table th:last-child,
.simple-table td:last-child {
    width: 150px;
}

.sage-panel {
    display: grid;
    gap: 20px;
    border-radius: 12px;
    background: #fffdf9;
}

.sage-tabs,
.sage-month-tabs,
.sage-type-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sage-tabs {
    position: relative;
    width: fit-content;
    padding: 4px;
    border: 1px solid rgba(214, 197, 177, 0.78);
    border-radius: 12px;
    background: #faf4ec;
    isolation: isolate;
    overflow: hidden;
}

.sage-tabs::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    z-index: -1;
    width: 104px;
    border-radius: 9px;
    background: var(--brand);
    box-shadow: 0 8px 18px rgba(13, 127, 118, 0.16);
    transform: translateX(0);
    transition: transform 180ms var(--motion-ease-out);
}

.sage-tabs.is-recibos::before {
    transform: translateX(calc(100% + 8px));
}

.sage-tabs.is-pendentes::before {
    transform: translateX(calc((100% + 8px) * 2));
}

.sage-tab,
.sage-month-tab,
.sage-type-tab {
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    border-radius: 9px;
    font-weight: 700;
}

.sage-tab {
    position: relative;
    z-index: 1;
    width: 104px;
    height: 36px;
    padding: 0 20px;
}

.sage-month-tab {
    height: 36px;
    padding: 0 12px;
    font-size: 0.92rem;
}

.sage-type-tab {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 13px;
    font-size: 0.88rem;
    text-decoration: none;
}

.sage-tab:hover,
.sage-month-tab:hover,
.sage-type-tab:hover {
    color: var(--brand-strong);
}

.sage-tab:hover,
.sage-tab:focus {
    background: transparent;
}

.sage-month-tab.is-active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 18px rgba(13, 127, 118, 0.16);
}

.sage-tab.is-active {
    border-color: transparent;
    background: transparent;
    color: #fff;
    box-shadow: none;
}

.sage-tab.is-active:hover {
    color: #fff;
}

.sage-sales-controls .sage-type-tabs {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(54px, 1fr));
    gap: 8px;
    isolation: isolate;
}

.sage-sales-controls .sage-type-tabs::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    width: calc((100% - 24px) / 4);
    border-radius: 9px;
    background: var(--brand);
    box-shadow: 0 8px 18px rgba(13, 127, 118, 0.16);
    transform: translateX(0);
    transition: transform 180ms var(--motion-ease-out);
}

.sage-customer-page .sage-sales-controls .sage-type-tabs::before {
    background: #f68920;
}

.sage-sales-controls .sage-type-tabs.is-type-fac::before {
    transform: translateX(calc(100% + 8px));
}

.sage-sales-controls .sage-type-tabs.is-type-fr::before {
    transform: translateX(calc((100% + 8px) * 2));
}

.sage-sales-controls .sage-type-tabs.is-type-nc::before {
    transform: translateX(calc((100% + 8px) * 3));
}

.sage-sales-controls .sage-type-tab {
    position: relative;
    z-index: 1;
    justify-content: center;
}

.sage-sales-controls .sage-type-tab:hover,
.sage-sales-controls .sage-type-tab:focus {
    background: transparent;
}

.sage-sales-controls .sage-type-tab.is-active {
    border-color: transparent;
    background: transparent;
    color: #fff;
    box-shadow: none;
}

.sage-sales-controls .sage-type-tab.is-active:hover {
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .sage-tabs::before,
    .sage-sales-controls .sage-type-tabs::before {
        transition: none;
    }
}

.sage-tab-panel,
.sage-month-panel {
    display: none;
}

.sage-tab-panel.is-active,
.sage-month-panel.is-active {
    display: grid;
    gap: 16px;
}

.sage-section-heading,
.sage-month-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
}

.sage-section-heading h2,
.sage-month-header h3 {
    margin: 0 0 4px;
    font-size: 1.28rem;
}

.sage-month-header .sage-type-tabs {
    justify-content: flex-end;
    margin-left: auto;
}

.sage-section-heading p {
    margin-bottom: 0;
    color: var(--muted);
}

.sage-kpis {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.sage-kpis div {
    min-width: 112px;
    padding: 9px 11px;
    border: 1px solid rgba(214, 197, 177, 0.72);
    border-radius: 8px;
    background: #fffaf4;
}

.sage-kpis span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.sage-kpis strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    white-space: nowrap;
}

.sage-filter-bar {
    display: grid;
    grid-template-columns: 88px minmax(150px, 180px) auto auto minmax(0, 1fr);
    align-items: end;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(214, 197, 177, 0.72);
    border-radius: 10px;
    background: #fffaf4;
}

.sage-filter-bar .sage-kpis {
    grid-column: 5;
    align-items: stretch;
    justify-content: flex-end;
    justify-self: end;
    width: fit-content;
    max-width: 100%;
}

.sage-filter-bar .sage-kpis div {
    min-width: 112px;
    padding: 8px 10px;
}

.sage-filter-bar .sage-kpis div:nth-child(-n + 2) {
    min-width: 62px;
}

.sage-filter-bar label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.sage-filter-bar label > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-filter-bar select {
    height: 38px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    color: var(--text);
    padding: 0 12px;
    font: inherit;
    font-weight: 700;
}

.sage-filter-bar button,
.sage-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.sage-filter-button {
    border: 1px solid rgba(15, 124, 113, 0.25);
    background: #fffdf9;
    color: var(--brand);
}

.sage-filter-button.is-active,
.sage-filter-button:hover {
    background: var(--brand);
    color: #fff;
}

.sage-sales-controls {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(214, 197, 177, 0.72);
    border-radius: 10px;
    background: #fffaf4;
}

.sage-sales-controls-top,
.sage-sales-period-row,
.sage-sales-controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.sage-sales-controls-top {
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
}

.sage-sales-controls .sage-filter-bar {
    display: flex;
    align-items: end;
    flex: 0 0 auto;
    gap: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.sage-sales-kpis {
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: flex-end;
    margin-left: auto;
}

.sage-sales-kpis div {
    min-width: 112px;
    padding: 8px 10px;
}

.sage-sales-kpis div:nth-child(-n + 2) {
    min-width: 62px;
}

.sage-receipts-kpis div {
    min-width: 112px;
}

.sage-pending-controls .sage-sales-controls-top {
    justify-content: flex-end;
}

.sage-pending-controls .sage-sales-period-row {
    align-items: end;
}

.sage-pending-controls .sage-current-period-title {
    min-width: 190px;
}

.sage-sales-controls .sage-filter-bar label:first-of-type {
    width: 88px;
}

.sage-sales-controls .sage-filter-bar label:nth-of-type(2) {
    width: 180px;
}

.sage-current-period-title {
    flex: 0 0 auto;
    min-width: 150px;
    margin: 0;
    font-size: 1.18rem;
    white-space: nowrap;
}

.sage-sales-controls .sage-type-tabs {
    margin-left: auto;
}

.sage-sales-controls .sage-payment-legend {
    margin-top: 0;
    margin-left: 0;
}

.sage-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(214, 197, 177, 0.82);
    border-radius: 10px;
    background: #fffdf9;
    box-shadow: 0 12px 28px rgba(43, 36, 31, 0.05);
}

.sage-data-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    table-layout: auto;
}

.sage-sales-table {
    min-width: 900px;
}

.sage-pending-table {
    min-width: 900px;
    table-layout: fixed;
}

.sage-pending-table th:first-child,
.sage-pending-table td:first-child {
    width: 170px;
}

.sage-pending-table th:nth-child(2),
.sage-pending-table td:nth-child(2) {
    width: auto;
}

.sage-pending-table th:nth-child(3),
.sage-pending-table td:nth-child(3) {
    width: 165px;
}

.sage-pending-table.has-sms th:last-child,
.sage-pending-table.has-sms td:last-child {
    width: 58px;
    text-align: center;
}

.sage-pending-customer-row td {
    vertical-align: middle;
}

.sage-pending-customer-row .sage-expand-button {
    width: 100%;
    justify-content: flex-start;
}

.sage-pending-customer-row td:nth-child(2) strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sage-pending-customer-row td:nth-child(2) span {
    display: block;
    margin-top: 4px;
}

.sage-pending-sms-cell {
    vertical-align: middle;
}

.sage-pending-sms-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-size: 1.18rem;
    line-height: 1;
    cursor: pointer;
}

.sage-pending-sms-button:hover,
.sage-pending-sms-button:focus-visible {
    background: rgba(18, 130, 116, 0.08);
    outline: none;
}

.sage-pending-total {
    color: #a20f12;
    font-weight: 800;
}

.sage-credit-value {
    color: #087a4d;
    font-weight: 800;
}

.sage-pending-detail-row > td {
    padding: 10px 14px 14px;
    background: #fff8ef;
}

.sage-pending-documents-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border: 1px solid rgba(214, 197, 177, 0.72);
    border-radius: 8px;
    overflow: hidden;
}

.sage-pending-documents-table th:first-child,
.sage-pending-documents-table td:first-child {
    width: 38%;
}

.sage-pending-documents-table th:nth-child(2),
.sage-pending-documents-table td:nth-child(2),
.sage-pending-documents-table th:nth-child(3),
.sage-pending-documents-table td:nth-child(3) {
    width: 14%;
}

.sage-pending-documents-table th:nth-child(4),
.sage-pending-documents-table td:nth-child(4),
.sage-pending-documents-table th:nth-child(5),
.sage-pending-documents-table td:nth-child(5) {
    width: 17%;
}

.sage-pending-documents-table th,
.sage-pending-documents-table td {
    padding: 10px 12px;
}

.sage-sales-table th:first-child,
.sage-sales-table td:first-child {
    width: 96px;
    white-space: nowrap;
}

.sage-sales-table .sage-document-cell {
    width: 205px;
    min-width: 205px;
    white-space: nowrap;
}

.sage-sales-table th:last-child,
.sage-sales-table .sage-rec-cell {
    width: 54px;
    min-width: 54px;
    text-align: center;
}

.sage-rec-cell {
    vertical-align: middle;
}

.sage-rec-cell .sage-expand-button-icon {
    margin: 0 auto;
}

.sage-document-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.sage-data-table th,
.sage-data-table td {
    padding: 11px 12px;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.sage-data-table thead th {
    border-top: 0;
    background: #f7efe6;
    color: var(--text);
    font-size: 0.78rem;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.sage-data-table thead th.num,
.sage-lines-table thead th.num {
    text-align: right;
}

.sage-data-table thead th.sage-action-heading,
.sage-lines-table thead th.sage-action-heading {
    text-align: center;
}

.sage-data-table tbody tr.is-cancelled {
    background: #fdecec;
    color: #7f1d1d;
}

.sage-data-table tbody tr.is-cancelled td {
    border-top-color: #f3caca;
}

.sage-data-table td strong {
    display: block;
    color: var(--text);
    font-size: 0.92rem;
}

.sage-data-table tr.is-cancelled td strong {
    color: #7f1d1d;
}

.sage-data-table td span {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    margin-top: 2px;
}

.sage-data-table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sage-document-row {
    cursor: default;
}

.sage-document-row[data-sage-detail-toggle] {
    cursor: pointer;
}

.sage-document-row:focus-visible {
    outline: 3px solid rgba(13, 127, 118, 0.28);
    outline-offset: -3px;
}

.sage-expand-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.sage-expand-button:hover,
.sage-expand-button:focus {
    background: transparent;
    color: var(--text);
}

.sage-expand-button-icon {
    width: 14px;
    height: 18px;
    justify-content: center;
    color: var(--muted);
}

.sage-expand-button-icon:hover,
.sage-expand-button-icon:focus {
    color: var(--brand-strong);
}

.sage-receipt-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    font-size: 1.05rem;
    line-height: 1;
}

.sage-receipt-toggle-button:hover,
.sage-receipt-toggle-button:focus {
    background: transparent;
    transform: none;
}

.sage-expand-icon {
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 150ms var(--motion-ease-out);
}

.sage-expand-button[aria-expanded="true"] .sage-expand-icon {
    transform: rotate(45deg);
}

.sage-payment-status {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    box-shadow: 0 0 0 2px #fffdf9;
}

.sage-payment-status.is-paid {
    background: #168b55;
}

.sage-payment-status.is-partial {
    background: #d9a21b;
}

.sage-payment-status.is-unpaid {
    background: #c94040;
}

.sage-payment-status.is-all {
    background: #8f857c;
}

.sage-payment-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: -6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.sage-payment-legend-items {
    display: inline-grid;
    grid-template-columns: 78px 116px 128px 118px;
    align-items: center;
    gap: 10px;
}

.sage-sales-controls .sage-payment-legend-items {
    position: relative;
    isolation: isolate;
}

.sage-sales-controls .sage-payment-legend-items::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    width: 78px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fffdf9;
    box-shadow: 0 8px 20px rgba(61, 48, 41, 0.08);
    transform: translateX(0);
    transition: transform 180ms var(--motion-ease-out), opacity 180ms var(--motion-ease-out);
}

.sage-sales-controls .sage-payment-legend-items.is-payment-paid::before {
    width: 116px;
    transform: translateX(88px);
}

.sage-sales-controls .sage-payment-legend-items.is-payment-partial::before {
    width: 128px;
    transform: translateX(214px);
}

.sage-sales-controls .sage-payment-legend-items.is-payment-unpaid::before {
    width: 118px;
    transform: translateX(352px);
}

.sage-payment-legend-items span,
.sage-payment-filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.sage-payment-filter {
    position: relative;
    z-index: 1;
    justify-content: center;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 800;
    transition: color 150ms var(--motion-ease-out);
}

.sage-sales-controls .sage-payment-filter {
    border-radius: 999px;
}

.sage-payment-filter:hover,
.sage-payment-filter.is-active {
    color: var(--text);
}

.sage-payment-filter.is-active {
    box-shadow: none;
}

.sage-payment-filter:hover,
.sage-payment-filter:focus {
    background: transparent;
    outline: 0;
}

@media (prefers-reduced-motion: reduce) {
    .sage-sales-controls .sage-payment-legend-items::before {
        transition: none;
    }
}

.sage-document-search-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
    margin-bottom: -6px;
}

.sage-inline-search {
    width: min(100%, 390px);
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sage-inline-search label {
    position: relative;
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.sage-inline-search input[type="search"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    color: var(--text);
    padding: 12px 14px 8px;
    font: inherit;
}

.sage-inline-search input[type="search"]:focus {
    border-color: var(--brand);
    outline: 0;
}

.sage-inline-search label > span {
    position: absolute;
    top: 50%;
    left: 13px;
    transform: translateY(-50%);
    padding: 0 6px;
    background: #fffdf9;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    pointer-events: none;
    transition: transform 140ms var(--motion-ease-out), color 140ms var(--motion-ease-out), opacity 140ms var(--motion-ease-out);
}

.sage-inline-search label:focus-within > span,
.sage-inline-search label:has(input:not(:placeholder-shown)) > span {
    top: 0;
    transform: translateY(-50%);
    color: var(--brand);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.sage-search-clear:hover,
.sage-search-clear:focus-visible {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    outline: 0;
}

.sage-payment-legend .sage-payment-status {
    display: inline-block;
    box-shadow: none;
}

.sage-invoice-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: auto;
    flex: 0 0 34px;
    border: 0;
    padding: 0;
    background: transparent;
    color: #c9302c;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0;
    cursor: pointer;
}

.sage-invoice-button:hover,
.sage-invoice-button:focus {
    background: transparent;
    color: #a42622;
}

.sage-invoice-modal-card {
    width: min(1120px, calc(100vw - 32px));
    height: min(90vh, 980px);
}

.modal-card.sage-sms-modal-card {
    width: min(620px, calc(100vw - 32px));
    height: auto;
    max-height: min(88vh, 780px);
    grid-template-rows: auto auto;
    overflow-y: auto;
    border-radius: 18px;
}

.sage-sms-modal-card .modal-header {
    padding: 22px 24px 14px;
    border-bottom: 0;
}

.sage-sms-modal-card .modal-header h2 {
    margin-bottom: 8px;
}

.sage-sms-form {
    display: grid;
    gap: 11px;
    padding: 0 24px 22px;
}

.sage-sms-message-field span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.sage-sms-phone-list {
    display: grid;
    gap: 2px;
    padding: 8px 12px;
    border: 1px solid rgba(214, 197, 177, 0.82);
    border-radius: 10px;
    background: #fffdf9;
}

.sage-sms-mode-fieldset {
    min-width: 0;
    margin: 1px 0 0;
    padding: 0;
    border: 0;
}

.sage-sms-mode-fieldset legend {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.sage-sms-mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.sage-sms-mode-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 64px;
    padding: 10px 12px;
    border: 1px solid rgba(214, 197, 177, 0.88);
    border-radius: 11px;
    background: #fffdf9;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.sage-sms-mode-options label:hover {
    border-color: rgba(38, 104, 75, 0.48);
    transform: translateY(-1px);
}

.sage-sms-mode-options label:has(input:checked) {
    border-color: var(--brand);
    background: #f0f8f3;
    box-shadow: inset 3px 0 0 var(--brand);
}

.sage-sms-mode-options label:has(input:focus-visible) {
    outline: 3px solid rgba(38, 104, 75, 0.2);
    outline-offset: 2px;
}

.sage-sms-mode-options input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--brand);
    flex: 0 0 auto;
}

.sage-sms-mode-options span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.sage-sms-mode-options strong {
    color: var(--ink);
    font-size: 0.88rem;
}

.sage-sms-mode-options small {
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.25;
}

.sage-sms-phone-heading {
    display: grid;
    gap: 4px;
    margin-bottom: -2px;
    color: var(--muted);
    font-size: 0.84rem;
}

.sage-sms-phone-heading strong {
    color: var(--ink);
    font-size: 0.92rem;
}

.sage-sms-phone-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.sage-sms-phone-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.sage-sms-phone-row input[type="text"],
.sage-sms-message-field textarea {
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
}

.sage-sms-phone-row input[type="text"] {
    height: 32px;
    padding: 0 2px;
    font-weight: 800;
}

.sage-sms-message-field {
    display: grid;
    gap: 6px;
}

.sage-sms-message-field textarea {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fffdf9;
    min-height: 172px;
    padding: 12px;
    line-height: 1.38;
    resize: vertical;
}

.sage-sms-counter {
    margin-top: -9px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-align: right;
}

.sage-sms-counter.is-over-limit {
    color: #a20f12;
}

.sage-sms-mode-note {
    margin: -6px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.sage-sms-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 2px;
}

.sage-sms-actions button {
    width: auto;
    min-width: 132px;
    height: 44px;
    padding: 0 18px;
    border-radius: 999px;
}

@media (max-width: 560px) {
    .sage-sms-mode-options {
        grid-template-columns: 1fr;
    }
}

.sage-invoice-modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-right: 340px;
}

.secondary-button.sage-print-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 1.55rem;
    line-height: 1;
    white-space: nowrap;
}

.secondary-button.sage-print-button:hover,
.secondary-button.sage-print-button:active,
.secondary-button.sage-print-button:focus-visible {
    background: transparent;
    box-shadow: none;
    color: inherit;
    transform: none;
    scale: 1;
}

.secondary-button.sage-print-button:focus-visible {
    outline: 2px solid #2f7455;
    outline-offset: 2px;
}

.sage-print-controls {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 68px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    height: 44px;
    min-height: 44px;
}

.sage-print-status {
    max-width: 250px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: right;
}

.sage-print-status.is-ready {
    color: #216647;
}

.sage-print-status.is-error {
    color: #b40000;
}

.sage-print-button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

@media (max-width: 700px) {
    .sage-invoice-modal-heading {
        padding-right: 108px;
    }

    .sage-invoice-modal-card .modal-header {
        padding-bottom: 30px;
    }

    .sage-invoice-modal-card .sage-print-status {
        position: absolute;
        top: 48px;
        right: -54px;
        width: min(250px, calc(100vw - 80px));
    }
}

#sage-invoice-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #f7f1ea;
}

.sage-detail-row > td {
    --sage-description-indent: 112px;
    padding: 0;
    background: #fff8ef;
}

.sage-detail-animate {
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    filter: blur(2px);
    transition:
        opacity 140ms var(--motion-ease-out),
        transform 180ms var(--motion-ease-out),
        filter 140ms var(--motion-ease-out);
}

.sage-detail-row.is-open .sage-detail-animate,
.sage-detail-row.is-opening .sage-detail-animate {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
    .sage-detail-animate {
        animation: none;
        transition: none;
        transform: none;
    }
}

.sage-empty-detail {
    padding: 14px 18px;
    color: var(--muted);
    font-size: 0.92rem;
}

.sage-document-origins {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 12px 18px 14px calc(var(--sage-description-indent) - 18px);
    padding: 10px 14px;
    border: 1px solid rgba(231, 123, 29, 0.2);
    border-left: 4px solid var(--accent);
    border-radius: 0 10px 10px 0;
    background: rgba(231, 123, 29, 0.06);
    line-height: 1.5;
}

.sage-document-origins strong {
    flex: 0 0 auto;
    color: var(--text);
}

.sage-document-origins span {
    color: var(--muted);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sage-document-origins + .sage-document-comments {
    margin-top: 8px;
}

.sage-document-comments {
    display: grid;
    gap: 5px;
    margin: 12px 18px 14px calc(var(--sage-description-indent) - 18px);
    padding: 12px 14px;
    border: 1px solid rgba(13, 127, 118, 0.18);
    border-left: 4px solid var(--brand);
    border-radius: 0 10px 10px 0;
    background: rgba(13, 127, 118, 0.055);
}

.sage-document-comments strong {
    color: var(--brand-dark);
    font-size: 0.78rem;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.sage-document-comments p {
    margin: 0;
    color: var(--text);
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.sage-receipt-payment-note {
    padding: 12px 18px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: right;
}

.sage-related-receipts {
    padding: 12px 18px 8px;
    border-top: 1px solid rgba(214, 197, 177, 0.75);
    background: rgba(13, 127, 118, 0.035);
}

.sage-related-receipts-title {
    margin: 0 0 8px;
    padding-left: 94px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-related-receipts-table {
    table-layout: fixed;
    border: 1px solid rgba(214, 197, 177, 0.7);
    border-radius: 8px;
    overflow: hidden;
}

.sage-related-receipts-table th:first-child,
.sage-related-receipts-table td:first-child {
    padding-left: 16px;
}

.sage-related-receipts-table th:nth-child(1),
.sage-related-receipts-table td:nth-child(1) {
    width: 21%;
}

.sage-related-receipts-table th:nth-child(2),
.sage-related-receipts-table td:nth-child(2) {
    width: 14%;
}

.sage-related-receipts-table th:nth-child(3),
.sage-related-receipts-table td:nth-child(3) {
    width: 28%;
}

.sage-related-receipts-table th:nth-child(4),
.sage-related-receipts-table td:nth-child(4),
.sage-related-receipts-table th:nth-child(5),
.sage-related-receipts-table td:nth-child(5),
.sage-related-receipts-table th:nth-child(6),
.sage-related-receipts-table td:nth-child(6) {
    width: 12.333%;
    text-align: right;
}

.sage-related-receipt-button {
    display: inline-flex;
    align-items: center;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.sage-related-receipt-button:hover,
.sage-related-receipt-button:focus {
    background: transparent;
    color: var(--text);
}

.sage-lines-table {
    width: 100%;
    border-collapse: collapse;
    background: #fffaf4;
    font-size: 0.9rem;
}

.sage-lines-table th,
.sage-lines-table td {
    padding: 9px 12px;
    border-top: 1px solid rgba(214, 197, 177, 0.75);
    text-align: left;
    vertical-align: top;
}

.sage-lines-table th:first-child,
.sage-lines-table td:first-child {
    padding-left: 112px;
}

.sage-lines-table thead th {
    background: rgba(13, 127, 118, 0.07);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
}

.sage-lines-table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sage-lines-table td strong {
    display: block;
    color: var(--text);
    font-size: 0.88rem;
    margin-bottom: 2px;
}

.sage-sale-lines-table {
    table-layout: fixed;
}

.sage-sale-lines-table th:nth-child(1),
.sage-sale-lines-table td:nth-child(1) {
    width: auto;
    max-width: 0;
    overflow-wrap: break-word;
    white-space: normal;
    word-break: normal;
}

.sage-sale-lines-table th:nth-child(2),
.sage-sale-lines-table td:nth-child(2) {
    width: 54px;
}

.sage-sale-lines-table th:nth-child(3),
.sage-sale-lines-table td:nth-child(3),
.sage-sale-lines-table th:nth-child(5),
.sage-sale-lines-table td:nth-child(5),
.sage-sale-lines-table th:nth-child(6),
.sage-sale-lines-table td:nth-child(6),
.sage-sale-lines-table th:nth-child(7),
.sage-sale-lines-table td:nth-child(7) {
    width: 82px;
}

.sage-sale-lines-table th:nth-child(4),
.sage-sale-lines-table td:nth-child(4) {
    width: 70px;
}

.sage-sale-lines-table th,
.sage-sale-lines-table td {
    padding-right: 10px;
}

.admin-table {
    table-layout: auto;
}

.admin-table th:last-child,
.admin-table td:last-child {
    width: 120px;
    white-space: nowrap;
}

.link-button {
    cursor: pointer;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--brand-strong);
    text-decoration: none;
    font: inherit;
    font-weight: 700;
}

.file-upload.is-disabled,
.analysis-dropzone.is-disabled {
    pointer-events: none;
}

.search-hit {
    background: #fff35a;
    color: #241a00;
    padding: 0 2px;
    border-radius: 3px;
}

.modal-open {
    overflow: hidden;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 18, 16, 0.6);
}

.modal-card {
    position: relative;
    width: min(1000px, calc(100vw - 32px));
    height: min(85vh, 900px);
    margin: 40px auto;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    display: grid;
    grid-template-rows: auto 1fr;
}

.modal-card-confirm {
    width: min(640px, calc(100vw - 32px));
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto;
}

.modal-card-settings {
    width: min(960px, calc(100vw - 32px));
    height: auto;
    max-height: min(88vh, 980px);
    grid-template-rows: auto 1fr;
}

.sage-accountants-modal-card {
    width: min(1080px, calc(100vw - 32px));
    height: auto;
    max-height: min(88vh, 900px);
    grid-template-rows: auto 1fr;
}

.sage-accountants-modal-body {
    display: grid;
    gap: 18px;
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.sage-accountant-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffaf4;
}

.sage-customer-page .sage-accountant-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.sage-accountant-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-accountant-form input,
.sage-accountants-list-row input {
    width: 100%;
    min-width: 0;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    color: var(--text);
    padding: 0 12px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    text-transform: none;
}

.sage-accountant-form button,
.sage-accountant-actions button {
    height: 40px;
    border-radius: 8px;
    white-space: nowrap;
}

.sage-accountants-list {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fffdf9;
}

.sage-accountants-list-head,
.sage-accountants-list-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.2fr) minmax(220px, 1.4fr) minmax(180px, auto);
    gap: 12px;
    align-items: center;
    padding: 9px 12px;
    border-top: 1px solid rgba(214, 197, 177, 0.75);
}

.sage-accountants-list-head.is-internal,
.sage-accountants-list-row.is-internal {
    grid-template-columns: minmax(210px, 1.25fr) minmax(108px, 0.55fr) minmax(180px, 1fr) minmax(260px, 1.45fr) minmax(188px, auto);
}

.sage-accountants-list-head {
    border-top: 0;
    background: rgba(13, 127, 118, 0.07);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sage-accountants-list-row {
    background: #fffaf4;
}

.sage-accountants-list-row:nth-child(odd) {
    background: #fffdf9;
}

.sage-accountants-list-row > [role="cell"] {
    min-width: 0;
}

.sage-accountants-list-row strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sage-accountant-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.sage-accountant-actions button {
    min-width: 92px;
    padding: 0 16px;
}

.sage-accountant-actions form {
    margin: 0;
}

.modal-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--line);
}

.modal-header p {
    margin-bottom: 0;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 1.15rem;
    line-height: 1;
}

.modal-close:hover,
.modal-close:active,
.modal-close:focus-visible {
    background: transparent;
    box-shadow: none;
    color: inherit;
    transform: none;
    scale: 1;
}

.modal-close:focus-visible {
    outline: 2px solid #2f7455;
    outline-offset: 2px;
}

.confirm-modal-body {
    display: grid;
    gap: 16px;
    padding: 20px 24px 24px;
}

.duplicate-list {
    display: grid;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
}

.duplicate-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffdf9;
    color: var(--muted);
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.supplier-email-form {
    gap: 18px;
}

.supplier-email-field {
    display: grid;
    gap: 6px;
}

.supplier-email-field span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.supplier-email-field input {
    width: 100%;
    min-width: 0;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf9;
    color: var(--text);
    padding: 0 12px;
    font: inherit;
}

.ai-settings-modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.secondary-button {
    background: #8f8479;
}

.secondary-button:hover {
    background: #786d63;
}

#modal-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #f4f4f4;
}

@media (max-width: 720px) {
    .auth-page,
    .dashboard-page {
        padding: 20px;
    }

    .auth-card,
    .panel {
        padding: 22px;
    }

    .sage-customer-page {
        background:
            linear-gradient(180deg, rgba(0, 0, 0, 0.74) 0, rgba(0, 0, 0, 0.74) 126px, transparent 126px),
            linear-gradient(135deg, #f7f1ea 0%, #eee1d0 100%);
    }

    .sage-customer-page::before {
        height: 126px;
    }

    .sage-customer-page .page-shell {
        width: min(100% - 28px, 620px);
        padding-top: 8px;
    }

    .sage-customer-page .shell-header {
        grid-template-columns: minmax(0, 1fr) max-content;
        padding: 20px;
    }

    .sage-customer-page .sage-outstanding-panel {
        position: relative;
        top: auto;
        z-index: auto;
    }

    .customer-site-topbar-inner {
        width: min(100% - 28px, 620px);
        justify-content: center;
        min-height: auto;
        padding: 8px 0;
    }

    .customer-site-contact {
        justify-content: center;
        gap: 9px 13px;
    }

    .customer-site-contact a {
        font-size: 0.82rem;
        gap: 7px;
    }

    .customer-site-contact i {
        font-size: 1rem;
    }

    .customer-portal-shell {
        width: min(100% - 28px, 620px);
        min-height: auto;
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 14px;
        align-content: center;
        padding: 28px 0 12px;
    }

    .customer-portal-logo {
        width: 126px;
    }

    .customer-portal-card {
        justify-self: stretch;
        padding: 30px 22px 26px;
    }

    .customer-portal-form {
        width: min(100%, 360px);
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .customer-portal-form label,
    .customer-portal-turnstile,
    .customer-portal-form button {
        grid-column: 1;
        grid-row: auto;
    }

    .customer-portal-turnstile {
        justify-self: center;
    }

    .customer-portal-shell .site-footer {
        grid-column: 1;
        justify-self: stretch;
        width: 100%;
    }

    .customer-portal-form button {
        width: 100%;
        min-width: 0;
    }

    .login-page {
        padding: 0;
    }

    .login-shell {
        width: min(100% - 28px, 620px);
        min-height: 100vh;
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 14px;
        align-content: center;
        padding: 28px 0 12px;
    }

    .login-brand {
        width: 126px;
    }

    .login-page .auth-card {
        justify-self: stretch;
        padding: 30px 22px 26px;
    }

    .login-page .auth-form {
        width: min(100%, 360px);
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .login-page .auth-form label,
    .auth-turnstile,
    .login-page .auth-form button {
        grid-column: 1;
        grid-row: auto;
    }

    .auth-turnstile {
        justify-self: center;
    }

    .login-page .auth-form button,
    .login-page .auth-reset-form button {
        width: 100%;
        min-width: 0;
    }

    .login-shell .site-footer {
        grid-column: 1;
        justify-self: stretch;
        width: 100%;
    }

    .shell-header {
        grid-template-columns: 1fr;
    }

    .sage-customer-page .shell-header {
        grid-template-columns: minmax(0, 1fr) max-content;
    }

    .session-line {
        display: grid;
        gap: 6px;
        grid-column: auto;
    }

    .grid-wide {
        grid-template-columns: 1fr;
    }

    .admin-launch-grid {
        grid-template-columns: 1fr;
    }

    .form-field-date,
    .form-field-fornecedor,
    .form-field-nome-fornecedor,
    .form-field-documento,
    .form-field-valor,
    .form-field-pdf,
    .form-field-submit {
        grid-column: auto;
        grid-row: auto;
        grid-template-rows: auto;
    }

    .form-field-submit::before {
        display: none;
    }

    .dashboard-page.area-fornecedores .admin-launch-grid {
        grid-template-columns: 1fr;
        row-gap: 12px;
    }

    .payment-fields-row,
    .supplier-fields-row,
    .supplier-upload-actions-row {
        grid-template-columns: 1fr;
    }

    .payment-upload-actions-row {
        grid-template-columns: 1fr;
    }

    .supplier-submit-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }

    .payment-submit-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }

    .ai-settings-grid {
        grid-template-columns: 1fr;
    }

    .sms-env-header,
    .sms-env-summary,
    .sms-provider-grid,
    .sms-provider-fields,
    .sms-balance-grid,
    .sms-provider-settings-footer,
    .sms-test-row,
    .sms-test-form,
    .sms-management-header,
    .sms-history-header,
    .sms-search-form,
    .sms-send-form {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .sms-provider-card-header {
        align-items: flex-start;
    }

    .sms-provider-settings-footer button {
        width: 100%;
        min-width: 0;
    }

    .sms-history-search-form {
        justify-content: stretch;
        align-self: stretch;
        width: 100%;
        min-width: 0;
    }

    .sms-history-tools {
        display: grid;
        grid-template-columns: 1fr;
        justify-content: stretch;
        width: 100%;
        min-width: 0;
    }

    .sms-history-refresh-button {
        width: 100%;
    }

    .sms-balance-card {
        width: 100%;
    }

    .sms-history-search-form .floating-search {
        width: 100%;
    }

    .sms-search-form label {
        grid-column: auto;
        margin-bottom: 0;
    }

    .ai-api-test-field,
    .ai-model-field,
    .ai-mode-field {
        grid-column: auto;
        grid-row: auto;
    }

    .ai-api-key-field,
    .ai-model-field,
    .ai-mode-field,
    .ai-api-test-field {
        min-height: 0;
    }

    .admin-launch-summary {
        align-items: flex-start;
    }

    .analysis-assistant-top {
        grid-template-columns: 1fr;
    }

    .analysis-assistant-top .analysis-dropzone,
    .analysis-assistant-top .analysis-preview-button {
        grid-column: auto;
    }

    .analysis-suggestions-grid {
        grid-template-columns: 1fr;
    }

    .analysis-preview-button,
    .analysis-apply-button {
        width: 100%;
        min-width: 0;
        justify-self: stretch;
    }

    .analysis-suggestions-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .analysis-progress {
        width: 100%;
        min-width: 0;
    }

    .archive-toolbar {
        display: grid;
        grid-template-columns: 1fr;
    }

    .sage-section-heading,
    .sage-month-header {
        display: grid;
        grid-template-columns: 1fr;
    }

    .sage-month-header .sage-type-tabs {
        justify-content: flex-start;
        margin-left: 0;
    }

    .sage-kpis {
        justify-content: flex-start;
    }

    .sage-filter-bar {
        grid-template-columns: 1fr;
    }

    .sage-filter-bar .sage-kpis {
        grid-column: 1;
        justify-content: flex-start;
        justify-self: start;
        width: 100%;
    }

    .sage-sales-controls-top,
    .sage-sales-period-row,
    .sage-sales-controls-bottom,
    .sage-sales-controls .sage-filter-bar {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .sage-sales-controls .sage-filter-bar label:first-of-type,
    .sage-sales-controls .sage-filter-bar label:nth-of-type(2),
    .sage-current-period-title {
        width: 100%;
        min-width: 0;
    }

    .sage-sales-kpis {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .sage-current-period-title {
        order: -1;
    }

    .sage-sales-controls .sage-payment-legend {
        margin-left: 0;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .sage-inline-search {
        margin-left: 0;
        width: 100%;
    }

    .sage-outstanding-panel,
    .sage-outstanding-item,
    .sage-payment-box {
        grid-template-columns: 1fr;
    }

    .sage-outstanding-list {
        grid-template-columns: 1fr;
        grid-column: auto;
    }

    .sage-payment-box > span {
        grid-column: auto;
        grid-row: auto;
    }

    .sage-payment-logo,
    .sage-payment-details {
        grid-column: auto;
        grid-row: auto;
    }

    .sage-outstanding-item strong {
        grid-column: 1;
        grid-row: auto;
    }

    .sage-month-tabs,
    .sage-type-tabs {
        width: auto;
        align-items: stretch;
    }

    .sage-month-tab,
    .sage-type-tab {
        flex: 1 1 130px;
    }

    .admin-list-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
    }

    .search-strip {
        justify-content: stretch;
        margin-top: 0;
    }

    .archive-search {
        width: 100%;
        flex: none;
        justify-items: stretch;
    }

    .archive-search-inline {
        display: grid;
        gap: 10px;
        grid-template-columns: 1fr;
    }

    .archive-search-fields {
        display: grid;
        gap: 10px;
    }

    .admin-search-fields .archive-search-row-text,
    .admin-search-fields .archive-search-row-top {
        width: 100%;
        max-width: none;
    }

    .archive-search-row-top,
    .archive-search-row-text {
        grid-template-columns: 1fr;
    }

    .archive-search input {
        text-align: left;
    }

    .sms-history-meta-grid {
        grid-template-columns: 1fr;
    }

    .archive-search input[type="date"] {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .modal-card {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        margin: 8px auto;
        border-radius: 18px;
    }

    .simple-list {
        overflow-x: auto;
    }
}

@media (max-width: 1040px) {
    .area-switcher-panel {
        grid-template-columns: 1fr;
    }

    .settings-users-layout {
        grid-template-columns: 1fr;
    }

    .user-settings-top {
        grid-template-columns: 1fr;
    }

    .admin-launch-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .form-field-date {
        grid-column: 1;
        grid-row: 1;
    }

    .form-field-fornecedor {
        grid-column: 2;
        grid-row: 1;
    }

    .form-field-nome-fornecedor {
        grid-column: 3;
        grid-row: 1;
    }

    .form-field-documento {
        grid-column: 1 / span 2;
        grid-row: 2;
    }

    .form-field-valor {
        grid-column: 3;
        grid-row: 2;
    }

    .form-field-pdf {
        grid-column: 1 / span 2;
        grid-row: 3;
    }

    .form-field-submit {
        grid-column: 3;
        grid-row: 3;
        grid-template-rows: 30px minmax(56px, auto);
    }

    .admin-submit-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .dashboard-page.area-fornecedores .admin-launch-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .payment-fields-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .supplier-fields-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .payment-upload-actions-row {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .supplier-upload-actions-row {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

/* Magilarmes 2026 visual identity */
:root { --magi-ink:#17221d; --magi-green:#24523c; --magi-green-2:#347455; --magi-lime:#b8cf54; --magi-line:rgba(27,62,46,.12); }
body.auth-page:not(.login-page), body.dashboard-page {
    color:var(--magi-ink);
    background:radial-gradient(circle at 8% 0%,rgba(184,207,84,.18),transparent 29rem),radial-gradient(circle at 100% 12%,rgba(52,116,85,.13),transparent 34rem),#f5f6f2;
}
.page-shell { max-width:1540px; }
.shell-header,.panel,.area-switcher-panel,.sage-outstanding-panel { border:1px solid var(--magi-line); box-shadow:0 22px 60px rgba(24,48,37,.08); }
.shell-header { overflow:hidden; position:relative; background:linear-gradient(125deg,#173c2b,#2f6b4d 68%,#527b45); color:#fff; }
.shell-header::after { content:""; position:absolute; right:-4rem; bottom:-7rem; width:20rem; height:20rem; border:3rem solid rgba(184,207,84,.13); border-radius:50%; pointer-events:none; }
.shell-header h1,.shell-header .lead,.shell-header .session-line,.shell-header .company-meta,.shell-header .session-meta { color:#fff; }
.logout-link,.header-settings-button { border-color:rgba(255,255,255,.3); background:rgba(255,255,255,.12); color:#fff; backdrop-filter:blur(10px); }
.logout-link:hover,.header-settings-button:hover { background:#fff; color:var(--magi-green); }
.sage-tab.is-active,.sage-filter-button.is-active,.sage-filter-bar button,.sage-type-tab.is-active,button[type="submit"] { background:linear-gradient(135deg,var(--magi-green),var(--magi-green-2)); color:#fff; }
.sage-tabs::before,.sage-sales-controls .sage-type-tabs::before { background:var(--magi-green); }
.area-switcher-link { min-height:116px; border:1px solid var(--magi-line); border-radius:22px; background:rgba(255,255,255,.86); box-shadow:0 16px 40px rgba(24,48,37,.06); }

@media (max-width: 1040px) {
    .inline-field-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .inline-field-row .form-field {
        flex: initial;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .inline-upload-actions-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .upload-flex-field,
    .submit-fixed-field {
        flex: initial;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .inline-submit-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .submit-fixed-button {
        width: 100%;
        min-width: 0;
    }
}
.area-switcher-link:hover,.area-switcher-link.is-active { border-color:rgba(52,116,85,.35); transform:translateY(-3px); box-shadow:0 22px 50px rgba(24,48,37,.12); }
.area-switcher-link.is-active { background:linear-gradient(145deg,#fff,#f0f5e5); }
.magilarmes-brand { width:min(280px,68vw); margin-inline:auto; }
.magilarmes-brand img { display:block; width:100%; height:96px; object-fit:contain; }
.auth-card { border:1px solid var(--magi-line); border-radius:30px; box-shadow:0 34px 90px rgba(24,48,37,.16); background:rgba(255,255,255,.9); backdrop-filter:blur(18px); }
.login-intro>span { color:var(--magi-green-2); letter-spacing:.12em; text-transform:uppercase; }
.login-page .auth-card,
.customer-portal-card { border:1px solid rgba(255,187,0,.34); border-top:4px solid #ffbb00; border-radius:28px; background:rgba(255,255,255,.94); box-shadow:0 34px 90px rgba(0,0,0,.3); backdrop-filter:blur(18px); }
.login-page .login-intro>span,
.customer-portal-intro>span { color:#e20000; }
.customer-portal-intro h1 span { color:#e20000; }
.login-page .auth-form button,
.customer-portal-form button { background:linear-gradient(135deg,#e20000,#b80000); }
.login-page .auth-form button:hover,
.customer-portal-form button:hover { background:linear-gradient(135deg,#c90000,#980000); }
.auth-form input:focus,.auth-reset-form input:focus,.form-field input:focus,.form-field textarea:focus,.form-field select:focus { border-color:var(--magi-green-2); box-shadow:0 0 0 4px rgba(52,116,85,.12); }
/* Refined shared application header */
.shell-header {
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:20px 28px;
    min-height:138px;
    padding:22px 26px 18px;
    border-top:4px solid #e20000;
    border-radius:24px;
    background:linear-gradient(118deg,rgba(255,255,255,.98),rgba(248,248,246,.96));
    color:var(--magi-ink);
    box-shadow:0 22px 60px rgba(48,52,50,.1);
}
.shell-header::before {
    content:"";
    position:absolute;
    top:-48px;
    right:12%;
    width:180px;
    height:180px;
    border:34px solid rgba(255,187,0,.1);
    border-radius:50%;
    pointer-events:none;
}
.shell-header::after {
    right:-72px;
    bottom:-112px;
    width:220px;
    height:220px;
    border:42px solid rgba(226,0,0,.045);
}
.shell-header-main,.header-actions,.session-line { position:relative; z-index:1; }
.app-header-brand {
    display:flex;
    align-items:center;
    gap:20px;
    width:max-content;
    max-width:100%;
    color:inherit;
    text-decoration:none;
}
.app-header-brand img {
    display:block;
    width:210px;
    height:72px;
    object-fit:contain;
    flex:0 0 auto;
}
.app-header-brand-copy {
    display:grid;
    gap:3px;
    min-width:0;
    padding-left:20px;
    border-left:1px solid rgba(120,124,123,.25);
}
.app-header-brand-copy small {
    color:#787c7b;
    font-size:.71rem;
    font-weight:800;
    letter-spacing:.14em;
    line-height:1.2;
    text-transform:uppercase;
}
.app-header-brand-copy strong {
    color:#303432;
    font-size:clamp(1.2rem,2vw,1.65rem);
    line-height:1.15;
}
.app-header-lead { margin:5px 0 0 250px; font-size:.9rem; }
.shell-header .header-actions { align-self:start; }
.shell-header .logout-link,.shell-header .header-settings-button {
    min-height:44px;
    padding:10px 17px;
    border:1px solid rgba(120,124,123,.24);
    background:#fff;
    color:#424745;
    box-shadow:0 8px 22px rgba(48,52,50,.07);
}
.shell-header .logout-link:hover,.shell-header .header-settings-button:hover {
    border-color:#e20000;
    background:#fff5f5;
    color:#b40000;
    transform:translateY(-1px);
}
.shell-header .header-actions .logout-link:last-child { border-color:#303432; background:#303432; color:#fff; }
.shell-header .header-actions .logout-link:last-child:hover { border-color:#e20000; background:#e20000; color:#fff; }
.session-line {
    display:flex;
    align-items:center;
    gap:8px;
    grid-column:1/-1;
    margin:0;
}
.shell-header .company-meta,.shell-header .session-meta {
    display:flex;
    align-items:center;
    gap:7px;
    margin:0;
    padding:7px 11px;
    border:1px solid rgba(120,124,123,.16);
    border-radius:999px;
    background:rgba(255,255,255,.74);
    color:#303432;
    font-size:.79rem;
    line-height:1;
}
.shell-header .company-meta span,.shell-header .session-meta span { color:#787c7b; font-weight:700; }
.shell-header .company-meta strong,.shell-header .session-meta strong { color:#303432; }
.shell-header .header-updated-at {
    display:flex;
    align-items:center;
    gap:5px;
    margin-left:auto;
    color:#787c7b;
    font-size:.79rem;
    font-weight:700;
    line-height:1;
    white-space:nowrap;
}
.shell-header .header-updated-at strong { color:#303432; font-weight:800; }
.shell-header .header-updated-at.is-unavailable { color:#787c7b; font-style:italic; font-weight:600; }
@media (max-width:760px) {
    .shell-header { grid-template-columns:1fr; min-height:0; padding:18px; border-radius:20px; }
    .app-header-brand { width:100%; gap:12px; }
    .app-header-brand img { width:150px; height:58px; }
    .app-header-brand-copy { padding-left:12px; }
    .app-header-brand-copy small { font-size:.6rem; letter-spacing:.1em; }
    .app-header-brand-copy strong { font-size:1.08rem; }
    .app-header-lead { display:none; }
    .shell-header .header-actions { width:100%; justify-content:flex-start; flex-wrap:wrap; }
    .session-line { flex-wrap:wrap; }
    .shell-header .header-updated-at { flex-basis:100%; margin-left:0; padding:3px 2px 0; }
}
@media (max-width:440px) {
    .app-header-brand { align-items:center; flex-direction:row; gap:10px; }
    .app-header-brand img { width:138px; height:56px; }
    .app-header-brand-copy { padding-left:10px; border-left:1px solid rgba(120,124,123,.25); }
    .app-header-brand-copy small { font-size:.54rem; }
    .app-header-brand-copy strong { font-size:.98rem; }
}

/* Consistent floating labels for every editable labelled field */
.floating-control,
label.floating-contained {
    position:relative;
    display:block;
    width:100%;
    min-width:0;
}
.floating-control > input,
.floating-control > select,
.floating-control > textarea,
label.floating-contained > input:not([type="checkbox"]):not([type="radio"]),
label.floating-contained > select,
label.floating-contained > textarea {
    width:100%;
    min-height:52px;
    padding:19px 13px 7px;
}
.floating-control > textarea,
label.floating-contained > textarea { min-height:120px; padding-top:22px; }
.floating-control > label,
label.floating-contained > span {
    position:absolute;
    z-index:2;
    top:50%;
    left:11px;
    max-width:calc(100% - 22px);
    margin:0;
    padding:0 5px;
    overflow:hidden;
    transform:translateY(-50%);
    background:#fffdf9;
    color:#777b79;
    font-size:.86rem;
    font-weight:700;
    line-height:1.2;
    text-overflow:ellipsis;
    white-space:nowrap;
    pointer-events:none;
    transition:transform 160ms var(--motion-ease-out),color 160ms var(--motion-ease-out),opacity 160ms var(--motion-ease-out);
}
.floating-control.is-textarea > label,
label.floating-contained.is-textarea > span { top:22px; }
.floating-control:focus-within > label,
.floating-control.is-filled > label,
.floating-control:has(> textarea:not(:placeholder-shown)) > label,
.floating-control:has(select) > label,
label.floating-contained:focus-within > span,
label.floating-contained.is-filled > span,
label.floating-contained:has(> textarea:not(:placeholder-shown)) > span,
label.floating-contained:has(select) > span {
    top:0;
    transform:translateY(-50%);
    color:#b40000;
    font-size:.66rem;
    font-weight:900;
    letter-spacing:.07em;
    text-transform:uppercase;
}
.floating-control > input::placeholder,
.floating-control > textarea::placeholder,
label.floating-contained > input::placeholder,
label.floating-contained > textarea::placeholder { color:transparent; }
.floating-control:focus-within > input::placeholder,
.floating-control:focus-within > textarea::placeholder,
label.floating-contained:focus-within > input::placeholder,
label.floating-contained:focus-within > textarea::placeholder { color:#9a9d9b; }
.floating-control:focus-within > input,
.floating-control:focus-within > select,
.floating-control:focus-within > textarea,
label.floating-contained:focus-within > input,
label.floating-contained:focus-within > select,
label.floating-contained:focus-within > textarea {
    border-color:#e20000;
    outline:0;
    box-shadow:0 0 0 4px rgba(226,0,0,.08);
}
.form-field > .floating-control { grid-column:1/-1; }
.auth-form > .floating-control { width:100%; }
.sage-filter-bar label.floating-contained { min-width:118px; }
.sage-filter-bar label.floating-contained > select { height:48px; }
.sage-sms-message-field.floating-contained > textarea {
    min-height:252px;
    border:1px solid var(--line);
    border-radius:9px;
    background:#fffdf9;
}
.ai-settings-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.ai-settings-grid .ai-api-test-field,.ai-settings-grid .ai-model-field,.ai-settings-grid .ai-mode-field { grid-column:auto; grid-row:auto; }
@media (max-width:600px) {
    .ai-settings-grid { grid-template-columns:1fr; }
    .floating-control > input,.floating-control > select,.floating-control > textarea,
    label.floating-contained > input:not([type="checkbox"]):not([type="radio"]),label.floating-contained > select,label.floating-contained > textarea { font-size:16px; }
}

/* Private customer documents */
.customer-documents-page .page-shell {
    width:min(100% - 32px,1540px);
    padding:12px 0 28px;
}
.customer-document-upload-panel,
.customer-document-list-panel {
    padding:30px;
    border-radius:26px;
    background:rgba(255,255,255,.94);
}
.customer-document-section-heading {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:24px;
    margin-bottom:24px;
}
.customer-document-section-heading h2 {
    margin:4px 0 7px;
    color:var(--magi-ink);
    font-size:clamp(1.45rem,2vw,2rem);
}
.customer-document-section-heading p {
    max-width:720px;
    margin:0;
    color:#6b736f;
    line-height:1.55;
}
.customer-document-eyebrow {
    color:#c60000;
    font-size:.72rem;
    font-weight:900;
    letter-spacing:.14em;
    text-transform:uppercase;
}
.customer-document-heading-insights {
    display:flex;
    align-items:stretch;
    justify-content:flex-end;
    gap:12px;
}
.customer-document-security-note,
.customer-document-storage-card {
    display:grid;
    gap:4px;
    padding:14px 17px;
    border:1px solid rgba(52,116,85,.16);
    border-radius:16px;
    background:linear-gradient(145deg,#f3f8ef,#fff);
    color:var(--magi-green);
}
.customer-document-security-note {
    min-width:250px;
    align-content:center;
}
.customer-document-security-note span {
    color:#6b736f;
    font-size:.82rem;
}
.customer-document-storage-card {
    min-width:285px;
    align-content:center;
    gap:5px;
}
.customer-document-storage-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
}
.customer-document-storage-heading span {
    color:#53615a;
    font-size:.72rem;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
}
.customer-document-storage-heading strong {
    color:var(--magi-green);
    font-size:.83rem;
    white-space:nowrap;
}
.customer-document-storage-card progress {
    width:100%;
    height:7px;
    overflow:hidden;
    border:0;
    border-radius:999px;
    background:#dfe9e2;
    appearance:none;
}
.customer-document-storage-card progress::-webkit-progress-bar {
    border-radius:999px;
    background:#dfe9e2;
}
.customer-document-storage-card progress::-webkit-progress-value {
    border-radius:999px;
    background:#347455;
}
.customer-document-storage-card progress::-moz-progress-bar {
    border-radius:999px;
    background:#347455;
}
.customer-document-storage-warning progress::-webkit-progress-value { background:#b98016; }
.customer-document-storage-warning progress::-moz-progress-bar { background:#b98016; }
.customer-document-storage-critical progress::-webkit-progress-value { background:#c60000; }
.customer-document-storage-critical progress::-moz-progress-bar { background:#c60000; }
.customer-document-storage-card small {
    color:#77807b;
    font-size:.67rem;
    line-height:1.35;
}
.customer-document-upload-form {
    display:grid;
    grid-template-columns:repeat(20,minmax(0,1fr));
    grid-template-rows:54px 54px 54px 54px;
    gap:18px;
    align-items:stretch;
}
.customer-document-field {
    position:relative;
    display:block;
    min-width:0;
}
.customer-document-field > span {
    position:absolute;
    z-index:2;
    top:0;
    left:12px;
    max-width:calc(100% - 24px);
    padding:0 6px;
    transform:translateY(-50%);
    overflow:hidden;
    background:#fff;
    color:#53615a;
    font-size:.68rem;
    font-weight:900;
    letter-spacing:.07em;
    text-overflow:ellipsis;
    text-transform:uppercase;
    white-space:nowrap;
    pointer-events:none;
}
.customer-document-field input,
.customer-document-field select,
.customer-document-field textarea {
    width:100%;
    min-height:54px;
    border:1px solid #d8dfda;
    border-radius:12px;
    background:#fff;
    color:var(--magi-ink);
    padding:16px 14px 8px;
    font:inherit;
}
.customer-document-field textarea {
    min-height:92px;
    padding-top:19px;
    resize:vertical;
}
.customer-document-field input:focus,
.customer-document-field select:focus,
.customer-document-field textarea:focus {
    border-color:#e20000;
    outline:0;
    box-shadow:0 0 0 4px rgba(226,0,0,.08);
}
.customer-document-field-client {
    grid-column:1 / span 12;
    grid-row:1;
}
.customer-client-combobox {
    z-index:8;
}
.customer-client-combobox.is-open {
    z-index:40;
}
.customer-client-combobox > #customer-client-label {
    color:#b40000;
    font-size:.66rem;
}
.customer-client-combobox-control {
    position:relative;
    height:100%;
}
.customer-client-combobox-control input {
    height:100%;
    padding-right:50px;
}
.customer-client-combobox-control input::-webkit-search-cancel-button {
    appearance:none;
}
.customer-client-combobox-clear {
    position:absolute;
    z-index:2;
    top:50%;
    right:10px;
    display:grid;
    width:34px;
    min-width:34px;
    height:34px;
    min-height:34px;
    padding:0;
    transform:translateY(-50%);
    place-items:center;
    border:0;
    border-radius:50%;
    color:#56635d;
    background:transparent;
    box-shadow:none;
    font-size:1.35rem;
    font-weight:500;
    line-height:1;
}
.customer-client-combobox-clear:hover,
.customer-client-combobox-clear:focus-visible {
    color:#a40000;
    background:#fff0f0;
    box-shadow:none;
}
.customer-client-combobox-clear[hidden] {
    display:none;
}
.customer-client-combobox-options {
    position:absolute;
    z-index:50;
    top:calc(100% + 7px);
    right:0;
    left:0;
    max-height:310px;
    padding:7px;
    overflow-y:auto;
    overscroll-behavior:contain;
    border:1px solid #cfd9d2;
    border-radius:14px;
    background:#fff;
    box-shadow:0 22px 48px rgba(22,42,34,.18),0 4px 12px rgba(22,42,34,.08);
}
.customer-client-combobox-options > .customer-client-combobox-option {
    display:flex!important;
    width:100%;
    min-height:0;
    padding:10px 12px;
    align-items:center;
    justify-content:flex-start!important;
    border:0;
    border-radius:9px;
    appearance:none;
    color:var(--magi-ink);
    background:transparent;
    box-shadow:none;
    font-family:inherit;
    font-size:.9rem;
    font-weight:700;
    line-height:1.35;
    text-align:left!important;
}
.customer-client-combobox-options > .customer-client-combobox-option > span {
    display:block;
    flex:1 1 auto;
    width:100%;
    overflow:hidden;
    font:inherit;
    text-align:left!important;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.customer-client-combobox-option:hover,
.customer-client-combobox-option:focus-visible,
.customer-client-combobox-option.is-active {
    color:#173e32;
    background:#edf7f1;
    box-shadow:inset 3px 0 0 var(--magi-green);
    outline:0;
}
.customer-client-combobox-empty {
    margin:0;
    padding:18px 14px;
    color:#6b736f;
    font-size:.86rem;
    text-align:center;
}
.customer-document-field-title {
    grid-column:13 / -1;
    grid-row:1;
}
.customer-document-field-category {
    grid-column:1 / span 5;
    grid-row:2;
}
.customer-document-field-date {
    grid-column:1 / span 5;
    grid-row:3;
}
.customer-document-field-description {
    grid-column:6 / span 10;
    grid-row:2 / span 2;
}
.customer-document-field-description textarea {
    height:100%;
    min-height:0;
}
.customer-document-file-field {
    grid-column:16 / -1;
    grid-row:2 / span 2;
    position:relative;
    min-height:0;
    display:grid;
    align-content:center;
    justify-items:center;
    gap:4px;
    padding:15px;
    overflow:hidden;
    border:1px dashed rgba(52,116,85,.45);
    border-radius:14px;
    background:#f7faf5;
    color:var(--magi-green);
    cursor:pointer;
}
.customer-document-file-field > span {
    font-size:.72rem;
    font-weight:900;
    letter-spacing:.08em;
    text-transform:uppercase;
}
.customer-document-file-field small {
    display:block;
    width:100%;
    overflow:hidden;
    font-weight:800;
    line-height:1.35;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.customer-document-file-field.has-file {
    border-color:rgba(52,116,85,.72);
    border-style:solid;
    background:#eef7f0;
    box-shadow:inset 0 0 0 3px rgba(52,116,85,.06);
}
.customer-document-file-field.has-file .customer-document-file-name {
    color:var(--magi-ink);
    font-size:.86rem;
    font-weight:950;
}
.customer-document-file-field input {
    position:absolute;
    z-index:1;
    inset:0;
    width:100%;
    height:100%;
    opacity:0;
    cursor:pointer;
}
.customer-document-file-remove {
    position:relative;
    z-index:2;
    min-height:0;
    padding:3px 8px;
    border:0;
    border-radius:999px;
    background:transparent;
    color:#b40000;
    font-size:.72rem;
    font-weight:900;
    line-height:1.25;
    text-decoration:underline;
    text-underline-offset:2px;
    cursor:pointer;
}
.customer-document-file-remove:hover,
.customer-document-file-remove:focus-visible {
    background:#fff1f1;
    color:#8f0000;
}
.customer-document-file-remove:focus-visible {
    outline:2px solid rgba(180,0,0,.28);
    outline-offset:2px;
}
.customer-document-file-remove[hidden] {
    display:none;
}
.customer-document-notification {
    grid-column:1 / span 15;
    grid-row:4;
    min-height:54px;
    display:flex;
    align-items:center;
    gap:10px;
    color:#46534d;
    font-size:.9rem;
    font-weight:700;
}
.customer-document-notification input {
    width:20px;
    height:20px;
    accent-color:var(--magi-green);
}
.customer-document-submit {
    grid-column:16 / -1;
    grid-row:4;
    width:100%;
    justify-self:end;
    min-height:54px;
    border-radius:999px;
    background:linear-gradient(135deg,#e20000,#b80000);
    font-weight:900;
}
.customer-document-list-heading {
    align-items:center;
}
.customer-document-count {
    flex:0 0 auto;
    padding:10px 15px;
    border-radius:999px;
    background:#eef4e6;
    color:var(--magi-green);
    font-size:.85rem;
}
.customer-document-filter-form {
    display:grid;
    grid-template-columns:minmax(240px,1fr) minmax(280px,1.4fr) auto auto;
    gap:14px;
    align-items:center;
    margin-bottom:24px;
    padding:18px;
    border:1px solid rgba(27,62,46,.1);
    border-radius:18px;
    background:#f7f8f5;
}
.customer-document-filter-form button,
.customer-document-filter-form > a {
    min-height:50px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0 22px;
    border-radius:999px;
    text-decoration:none;
}
.customer-document-empty {
    display:grid;
    justify-items:center;
    gap:7px;
    padding:58px 24px;
    border:1px dashed rgba(52,116,85,.24);
    border-radius:20px;
    background:#fafbf8;
    color:#6b736f;
    text-align:center;
}
.customer-document-empty strong {
    color:var(--magi-ink);
    font-size:1.05rem;
}
.customer-document-grid {
    display:grid;
    grid-template-columns:1fr;
    gap:16px;
}
.customer-document-card {
    min-width:0;
    display:grid;
    grid-template-columns:68px minmax(0,1fr) auto;
    gap:18px;
    align-items:center;
    padding:20px;
    border:1px solid rgba(27,62,46,.11);
    border-radius:20px;
    background:linear-gradient(145deg,#fff,#fbfcf9);
    box-shadow:0 14px 34px rgba(24,48,37,.06);
}
.customer-document-card.is-hidden {
    opacity:.62;
    border-style:dashed;
}
.customer-document-card-icon {
    width:64px;
    height:76px;
    display:grid;
    place-items:end center;
    padding-bottom:13px;
    border-radius:9px 18px 9px 9px;
    background:linear-gradient(150deg,#e20000,#a60000);
    color:#fff;
    font-size:.72rem;
    font-weight:900;
    letter-spacing:.06em;
    box-shadow:0 10px 24px rgba(184,0,0,.2);
}
.customer-document-card-copy {
    min-width:0;
    display:grid;
    grid-template-columns:minmax(240px,.9fr) minmax(0,1.1fr);
    grid-template-rows:auto auto auto;
    align-items:center;
    column-gap:18px;
    row-gap:5px;
}
.customer-document-card-meta {
    grid-column:1;
    grid-row:1;
    display:flex;
    gap:10px;
    align-items:center;
    min-width:0;
    overflow:hidden;
    color:#77807b;
    font-size:.75rem;
    font-weight:800;
    text-transform:uppercase;
    white-space:nowrap;
}
.customer-document-card-meta span {
    color:var(--magi-green-2);
}
.customer-document-card-copy h3 {
    grid-column:2;
    grid-row:1;
    min-width:0;
    margin:0;
    overflow:hidden;
    color:var(--magi-ink);
    font-size:1.08rem;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.customer-document-card-copy p {
    margin:5px 0;
    color:#69726e;
    font-size:.88rem;
    line-height:1.45;
}
.customer-document-card-copy > small {
    grid-column:2;
    grid-row:3;
    display:block;
    margin-top:0;
    overflow:hidden;
    color:#8a918d;
    font-size:.75rem;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.customer-document-client-name {
    grid-column:1;
    grid-row:2 / span 2;
    display:grid;
    align-content:center;
    gap:1px;
    min-width:0;
    margin:0;
    overflow:hidden;
    white-space:nowrap;
}
.customer-document-client-name strong {
    min-width:0;
    overflow:hidden;
    color:#3d4843;
    text-overflow:ellipsis;
}
.customer-document-client-name span {
    min-width:0;
    overflow:hidden;
    font-size:.78rem;
    text-overflow:ellipsis;
}
.customer-document-card-copy > p:not(.customer-document-client-name) {
    grid-column:2;
    grid-row:2;
    min-width:0;
    margin:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sage-customer-page .customer-document-card-copy > p:not(.customer-document-client-name) {
    grid-column:1/-1;
}
.sage-customer-page .customer-document-card-copy > small {
    grid-column:1/-1;
}
.customer-document-card-actions {
    display:flex;
    gap:7px;
    align-items:center;
    flex-wrap:nowrap;
}
.customer-document-card-actions a,
.customer-document-card-actions button {
    min-width:112px;
    min-height:38px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:8px 13px;
    border:2px solid transparent;
    border-radius:999px;
    text-decoration:none;
    font-size:.78rem;
    font-weight:900;
    line-height:1.2;
    transition:background-color 160ms var(--motion-ease-out),border-color 160ms var(--motion-ease-out),color 160ms var(--motion-ease-out),box-shadow 160ms var(--motion-ease-out),transform 160ms var(--motion-ease-out);
}
.customer-document-card-actions > .customer-document-open-button,
.customer-document-card-actions > .customer-document-open-button:visited {
    border-color:#245c42;
    background:#245c42;
    color:#fff;
    box-shadow:0 7px 18px rgba(36,92,66,.18);
}
.customer-document-card-actions > .customer-document-open-button:hover {
    border-color:#173f2d;
    background:#173f2d;
    color:#fff;
    transform:translateY(-1px);
}
.customer-document-card-actions > .customer-document-download-button,
.customer-document-card-actions > .customer-document-download-button:visited,
.customer-document-card-actions > .customer-document-send-button {
    border-color:#245c42;
    background:#fff;
    color:#1d5139;
    box-shadow:0 5px 14px rgba(36,92,66,.08);
}
.customer-document-card-actions > .customer-document-download-button:hover,
.customer-document-card-actions > .customer-document-send-button:hover {
    border-color:#1d5139;
    background:#eaf4ed;
    color:#173f2d;
    transform:translateY(-1px);
}
.customer-document-card-actions > .customer-document-open-button:focus-visible,
.customer-document-card-actions > .customer-document-download-button:focus-visible,
.customer-document-card-actions > .customer-document-send-button:focus-visible {
    outline:3px solid rgba(240,170,18,.48);
    outline-offset:2px;
}
.customer-document-card-actions form {
    flex:0 0 auto;
    margin:0;
}
.customer-document-card-actions .danger-button {
    width:100%;
    border:1px solid rgba(190,0,0,.18);
    background:#fff1f1;
    color:#b40000;
}
.customer-document-preview-card {
    width:min(1120px,calc(100vw - 32px));
    height:min(90vh,920px);
    grid-template-rows:auto minmax(0,1fr) auto;
    border:1px solid rgba(27,62,46,.13);
    background:#fbfcf9;
}
.customer-document-modal-header {
    padding:24px 78px 18px 28px;
    background:linear-gradient(135deg,#fff 0%,#f8faf6 100%);
}
.customer-document-modal-header h2 {
    margin:5px 0 0;
    color:var(--magi-ink);
    font-size:clamp(1.35rem,2.4vw,1.85rem);
}
.customer-document-modal-header p {
    color:#707973;
    font-size:.88rem;
}
.customer-document-preview-body {
    position:relative;
    min-height:0;
    overflow:hidden;
    background:#e9eee9;
}
.customer-document-preview-body iframe {
    width:100%;
    height:100%;
    border:0;
    background:#fff;
}
.customer-document-preview-loading,
.customer-document-preview-fallback {
    position:absolute;
    inset:0;
    z-index:1;
    display:grid;
    place-content:center;
    justify-items:center;
    gap:11px;
    padding:28px;
    background:#f4f7f2;
    color:#526059;
    text-align:center;
}
.customer-document-preview-loading[hidden],
.customer-document-preview-fallback[hidden] {
    display:none;
}
.customer-document-preview-loading > span {
    width:44px;
    height:44px;
    border:4px solid rgba(36,92,66,.14);
    border-top-color:#245c42;
    border-radius:50%;
    animation:customer-document-preview-spin .8s linear infinite;
}
.customer-document-preview-fallback strong {
    color:var(--magi-ink);
    font-size:1.12rem;
}
.customer-document-preview-fallback p {
    margin:0;
}
.customer-document-modal-actions {
    display:flex;
    justify-content:flex-end;
    gap:10px;
    padding:15px 22px;
    border-top:1px solid rgba(27,62,46,.11);
    background:#fff;
}
.customer-document-modal-actions > a,
.customer-document-modal-actions > button {
    min-width:156px;
    min-height:44px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    font-weight:850;
    text-decoration:none;
}
.customer-document-send-card {
    width:min(720px,calc(100vw - 32px));
    max-height:min(90vh,760px);
    overflow-y:auto;
    grid-template-rows:auto auto;
    border:1px solid rgba(27,62,46,.13);
    background:#fbfcf9;
}
.customer-document-send-form {
    display:grid;
    gap:20px;
    padding:22px 28px 26px;
}
.customer-document-send-file {
    display:grid;
    gap:5px;
    padding:16px 18px;
    border:1px solid rgba(36,92,66,.14);
    border-left:4px solid #245c42;
    border-radius:12px;
    background:#f2f7f2;
}
.customer-document-send-file span {
    color:#758078;
    font-size:.7rem;
    font-weight:900;
    letter-spacing:.08em;
    text-transform:uppercase;
}
.customer-document-send-file strong {
    overflow-wrap:anywhere;
    color:var(--magi-ink);
}
.customer-document-send-file small {
    color:#68736d;
    line-height:1.45;
}
.customer-document-send-recipients {
    min-height:56px;
}
.customer-document-send-recipients input {
    padding-right:16px;
}
.customer-document-send-recipients > small {
    margin:6px 4px 0;
    color:#707973;
    font-size:.78rem;
    line-height:1.45;
}
.customer-document-modal-actions button.is-loading {
    position:relative;
    overflow:hidden;
    cursor:progress;
}
.customer-document-modal-actions button.is-loading::after {
    content:"";
    position:absolute;
    inset:auto 14px 5px;
    height:2px;
    border-radius:999px;
    background:rgba(255,255,255,.72);
    transform:translateX(-110%);
    animation:customer-document-send-progress .9s linear infinite;
}
@keyframes customer-document-preview-spin {
    to { transform:rotate(360deg); }
}
@keyframes customer-document-send-progress {
    to { transform:translateX(110%); }
}
@media (max-width:1250px) {
    .customer-document-card { grid-template-columns:68px minmax(0,1fr); }
    .customer-document-card-actions {
        grid-column:1/-1;
        display:grid;
        grid-template-columns:repeat(4,minmax(0,1fr));
    }
    .sage-customer-page .customer-document-card-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .customer-document-card-actions a,
    .customer-document-card-actions button { width:100%; min-width:0; }
}
@media (max-width:1100px) {
    .customer-document-upload-form { grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:auto; }
    .customer-document-field-client,
    .customer-document-field-description { grid-column:1/-1; }
    .customer-document-field-title,
    .customer-document-field-category,
    .customer-document-field-date,
    .customer-document-file-field,
    .customer-document-notification,
    .customer-document-submit { grid-column:auto; }
    .customer-document-field-client,
    .customer-document-field-title,
    .customer-document-field-category,
    .customer-document-field-date,
    .customer-document-field-description,
    .customer-document-file-field,
    .customer-document-notification,
    .customer-document-submit { grid-row:auto; }
    .customer-document-field-description textarea,
    .customer-document-file-field { min-height:92px; }
    .customer-document-grid { grid-template-columns:1fr; }
}
@media (max-width:760px) {
    .customer-documents-page .page-shell { width:min(100% - 20px,1540px); }
    .customer-document-upload-panel,.customer-document-list-panel { padding:21px 16px; border-radius:20px; }
    .customer-document-section-heading { display:grid; gap:14px; }
    .customer-document-heading-insights { display:grid; grid-template-columns:1fr; }
    .customer-document-security-note,.customer-document-storage-card { min-width:0; }
    .customer-document-upload-form,.customer-document-filter-form { grid-template-columns:1fr; }
    .customer-document-field-client,.customer-document-field-description { grid-column:auto; }
    .customer-document-upload-form > * { grid-column:1; grid-row:auto; }
    .customer-document-card { grid-template-columns:52px minmax(0,1fr); gap:13px; padding:16px; }
    .customer-document-card-icon { width:50px; height:62px; }
    .customer-document-card-copy { display:block; }
    .customer-document-card-copy h3 { margin:6px 0; white-space:normal; }
    .customer-document-card-copy > p:not(.customer-document-client-name) { margin:5px 0; white-space:normal; }
    .customer-document-client-name { display:grid; gap:1px; white-space:normal; }
    .customer-document-card-copy > small { margin-top:8px; }
    .customer-document-card-actions { grid-column:1/-1; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .customer-document-card-actions a,.customer-document-card-actions button { width:100%; min-width:0; }
    .customer-document-preview-card { width:calc(100vw - 20px); height:calc(100dvh - 20px); margin:10px auto; border-radius:18px; }
    .customer-document-send-card { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); margin:10px auto; border-radius:18px; }
    .customer-document-modal-header { padding:21px 62px 15px 20px; }
    .customer-document-send-form { padding:18px 20px 22px; }
    .customer-document-modal-actions { display:grid; grid-template-columns:1fr; padding:13px 16px; }
    .customer-document-modal-actions > a,
    .customer-document-modal-actions > button { width:100%; min-width:0; }
}

/* Customer portal header */
.sage-customer-page .sage-customer-header {
    isolation:isolate;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:22px;
    min-height:116px;
    padding:17px 20px;
    overflow:hidden;
    border:1px solid rgba(83,69,53,.13);
    border-top:1px solid rgba(83,69,53,.13);
    border-radius:18px;
    background:linear-gradient(112deg,rgba(255,255,255,.99),rgba(255,251,246,.98));
    box-shadow:0 22px 56px rgba(26,31,29,.15);
}
.sage-customer-page .sage-customer-header::before {
    inset:0 0 auto;
    width:auto;
    height:4px;
    border:0;
    border-radius:0;
    background:linear-gradient(90deg,#00615b 0 16%,#ffb000 16% 35%,#e20000 35% 49%,rgba(226,0,0,.08) 49% 100%);
}
.sage-customer-page .sage-customer-header::after {
    right:-88px;
    bottom:-134px;
    width:260px;
    height:260px;
    border:38px solid rgba(246,137,32,.07);
}
.sage-customer-page .sage-customer-header .shell-header-main {
    overflow:hidden;
}
.sage-customer-page .sage-customer-identity {
    gap:18px;
    width:100%;
}
.sage-customer-page .sage-customer-identity img {
    width:164px;
    height:76px;
    padding:3px 0;
}
.sage-customer-page .sage-customer-identity .app-header-brand-copy {
    gap:4px;
    max-width:100%;
    padding-left:18px;
    border-left-color:rgba(46,52,49,.16);
}
.sage-customer-page .sage-customer-identity .app-header-brand-copy > small {
    color:#d96500;
    font-size:.66rem;
    letter-spacing:.18em;
}
.sage-customer-page .sage-customer-identity .app-header-brand-copy > strong {
    display:block;
    max-width:min(41vw,530px);
    overflow:hidden;
    color:#252a28;
    font-size:clamp(1.25rem,2vw,1.72rem);
    letter-spacing:-.018em;
    text-overflow:ellipsis;
    text-transform:uppercase;
    white-space:nowrap;
}
.sage-customer-header-note {
    display:flex;
    align-items:center;
    gap:7px;
    color:#747a77;
    font-size:.74rem;
    font-weight:700;
    line-height:1.25;
}
.sage-customer-secure-dot {
    width:7px;
    height:7px;
    flex:0 0 auto;
    border-radius:50%;
    background:#2d7958;
    box-shadow:0 0 0 3px rgba(45,121,88,.12);
}
.sage-customer-page .sage-customer-header-actions {
    align-self:center;
    gap:9px;
}
.sage-customer-header-actions svg {
    width:18px;
    height:18px;
    flex:0 0 auto;
    fill:none;
    stroke:currentColor;
    stroke-linecap:round;
    stroke-linejoin:round;
    stroke-width:1.8;
}
.sage-customer-page .sage-customer-header .sage-customer-header-actions .logout-link {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    height:58px;
    min-height:58px;
    margin:0;
    padding:10px 14px;
    border:1px solid rgba(38,91,66,.16);
    border-radius:14px;
    background:#f5f9f6;
    color:#285d45;
    box-shadow:none;
    font-size:.8rem;
    font-weight:900;
}
.sage-customer-page .sage-customer-header .sage-customer-header-actions .logout-link:hover {
    border-color:rgba(38,91,66,.34);
    background:#eaf3ed;
    color:#1b4b35;
    transform:translateY(-1px);
}
.sage-customer-page .sage-customer-header .sage-customer-documents-link {
    min-width:190px;
}
.sage-customer-page .sage-customer-header .sage-customer-billing-link {
    min-width:144px;
}
.sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-documents-link,
.sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-billing-link {
    border-left:3px solid #2d7958;
    background:linear-gradient(135deg,#fff,#f2f8f4);
    box-shadow:0 8px 22px rgba(32,65,49,.06);
}
.sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-documents-link:hover,
.sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-billing-link:hover {
    border-left-color:#1b4b35;
}
.sage-customer-page .sage-customer-header .sage-customer-balance {
    display:grid;
    grid-template-columns:auto auto;
    align-items:center;
    gap:0 9px;
    min-width:190px;
    height:58px;
    min-height:58px;
    padding:8px 12px 8px 14px;
    border:1px solid rgba(45,121,88,.17);
    border-left:3px solid #2d7958;
    border-radius:14px;
    background:linear-gradient(135deg,#fff,#f2f8f4);
    color:#285d45;
    text-align:left;
    box-shadow:0 8px 22px rgba(32,65,49,.06);
}
.sage-customer-page .sage-customer-header .sage-customer-balance.has-debt {
    border-color:rgba(194,33,33,.17);
    border-left-color:#c22121;
    background:linear-gradient(135deg,#fff,#fff5f3);
    color:#b01d1d;
}
.sage-customer-page .sage-customer-header .sage-customer-balance.has-credit {
    border-left-color:#2d7958;
}
.sage-customer-page .sage-customer-header .sage-customer-balance-label {
    color:#6f7471;
    font-size:.63rem;
    letter-spacing:.06em;
    line-height:1;
}
.sage-customer-page .sage-customer-header .sage-customer-balance strong {
    justify-self:end;
    font-size:1rem;
    line-height:1.1;
}
.sage-customer-page .sage-customer-header .sage-customer-balance small {
    grid-column:1/-1;
    margin-top:4px;
    color:#787d7a;
    font-size:.65rem;
    font-weight:700;
    letter-spacing:0;
    line-height:1.1;
    text-align:right;
    text-transform:none;
}
.sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-signout {
    min-width:82px;
    border-color:#303432;
    background:#303432;
    color:#fff;
}
.sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-signout:hover {
    border-color:#bd1616;
    background:#bd1616;
    color:#fff;
}
@media (max-width:1180px) {
    .sage-customer-page .sage-customer-header {
        grid-template-columns:1fr;
        gap:14px;
    }
    .sage-customer-page .sage-customer-identity .app-header-brand-copy > strong {
        max-width:none;
    }
    .sage-customer-page .sage-customer-header-actions {
        display:grid;
        grid-template-columns:minmax(190px,1fr) minmax(190px,auto) auto;
        width:100%;
    }
}
@media (max-width:680px) {
    .sage-customer-page .page-shell {
        width:min(100% - 20px,1540px);
        padding-top:10px;
    }
    .sage-customer-page .sage-customer-header {
        gap:15px;
        padding:16px 14px 14px;
        border-radius:16px;
    }
    .sage-customer-page .sage-customer-identity {
        gap:12px;
    }
    .sage-customer-page .sage-customer-identity img {
        width:122px;
        height:62px;
    }
    .sage-customer-page .sage-customer-identity .app-header-brand-copy {
        padding-left:12px;
    }
    .sage-customer-page .sage-customer-identity .app-header-brand-copy > small {
        font-size:.56rem;
        letter-spacing:.12em;
    }
    .sage-customer-page .sage-customer-identity .app-header-brand-copy > strong {
        display:-webkit-box;
        overflow:hidden;
        font-size:1rem;
        line-height:1.15;
        text-overflow:ellipsis;
        white-space:normal;
        -webkit-box-orient:vertical;
        -webkit-line-clamp:2;
    }
    .sage-customer-header-note {
        font-size:.63rem;
    }
    .sage-customer-page .sage-customer-header-actions {
        grid-template-columns:minmax(0,1fr) auto;
        gap:8px;
    }
    .sage-customer-page .sage-customer-header .sage-customer-documents-link {
        min-width:0;
    }
    .sage-customer-page .sage-customer-header .sage-customer-billing-link {
        min-width:0;
    }
    .sage-customer-page .sage-customer-header .sage-customer-balance {
        grid-column:1/-1;
        grid-row:2;
        min-width:0;
    }
    .sage-customer-page .sage-customer-header .sage-customer-header-actions .sage-customer-signout {
        grid-column:2;
        grid-row:1;
        min-width:74px;
    }
}
@media (max-width:410px) {
    .sage-customer-page .sage-customer-identity img {
        width:102px;
        height:56px;
    }
    .sage-customer-page .sage-customer-identity .app-header-brand-copy {
        padding-left:10px;
    }
    .sage-customer-page .sage-customer-identity .app-header-brand-copy > strong {
        font-size:.91rem;
    }
    .sage-customer-header-note {
        align-items:flex-start;
    }
}

/* Unified application content grid. */
@media (min-width:761px) {
    .dashboard-page .page-shell {
        width:min(100% - 32px,1540px);
        max-width:1540px;
    }
}

/* Global motion system: purposeful, fast and accessible. */
.motion-skeleton-screen {
    position:fixed;
    inset:0;
    z-index:12000;
    display:grid;
    place-items:start center;
    padding:clamp(16px,4vw,48px);
    overflow:hidden;
    visibility:hidden;
    opacity:0;
    pointer-events:none;
    background:
        radial-gradient(circle at 12% 8%,rgba(43,109,78,.12),transparent 30rem),
        linear-gradient(145deg,#f8f7f1,#edf1e8);
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease-in),
        visibility 0s linear var(--motion-duration-fast);
}

html.motion-pending .motion-skeleton-screen,
html.motion-exiting .motion-skeleton-screen {
    visibility:visible;
    opacity:1;
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease-out),
        visibility 0s linear 0s;
}

.motion-skeleton-layout {
    width:min(100%,1540px);
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(240px,.38fr);
    grid-template-rows:92px 34px 18px minmax(190px,1fr);
    gap:18px;
}

.motion-skeleton-layout > span {
    position:relative;
    display:block;
    overflow:hidden;
    border-radius:18px;
    background:rgba(255,255,255,.78);
    box-shadow:
        0 0 0 1px rgba(37,78,58,.06),
        0 12px 36px rgba(37,78,58,.07);
}

.motion-skeleton-layout > span::after {
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(100deg,transparent 18%,rgba(255,255,255,.86) 48%,transparent 78%);
    transform:translateX(-110%);
}

html.motion-pending .motion-skeleton-layout > span::after,
html.motion-exiting .motion-skeleton-layout > span::after {
    animation:motion-skeleton-sweep 1.15s linear infinite;
    will-change:transform;
}

.motion-skeleton-header { grid-column:1/-1; }
.motion-skeleton-title { grid-column:1; width:min(62%,620px); }
.motion-skeleton-copy { grid-column:1; width:min(44%,440px); }
.motion-skeleton-card-primary { grid-column:1; min-height:360px; }
.motion-skeleton-card-secondary { grid-column:2; grid-row:2/5; min-height:430px; }

@keyframes motion-skeleton-sweep {
    to { transform:translateX(110%); }
}

html.motion-enabled body > .login-shell,
html.motion-enabled body > .page-shell,
html.motion-enabled body > .customer-site-header,
html.motion-enabled body > .customer-portal-shell,
html.motion-enabled body > .system-notices {
    transition:
        opacity var(--motion-duration-base) var(--motion-ease-out),
        transform var(--motion-duration-base) var(--motion-ease-out),
        filter var(--motion-duration-fast) var(--motion-ease-out);
}

html.motion-pending body > .login-shell,
html.motion-pending body > .page-shell,
html.motion-pending body > .customer-site-header,
html.motion-pending body > .customer-portal-shell,
html.motion-pending body > .system-notices {
    opacity:0;
    transform:translateY(8px);
    filter:blur(2px);
}

html.motion-ready body > .login-shell,
html.motion-ready body > .page-shell,
html.motion-ready body > .customer-site-header,
html.motion-ready body > .customer-portal-shell,
html.motion-ready body > .system-notices {
    opacity:1;
    transform:translateY(0);
    filter:blur(0);
}

html.motion-exiting body > .login-shell,
html.motion-exiting body > .page-shell,
html.motion-exiting body > .customer-site-header,
html.motion-exiting body > .customer-portal-shell,
html.motion-exiting body > .system-notices {
    opacity:.35;
    transform:translateY(-4px);
    filter:blur(1px);
    transition-duration:var(--motion-duration-instant);
    transition-timing-function:var(--motion-ease-in);
}

.motion-global-progress {
    position:fixed;
    z-index:13000;
    inset:0 0 auto;
    height:4px;
    overflow:hidden;
    opacity:0;
    pointer-events:none;
    background:rgba(255,255,255,.34);
    transition:opacity var(--motion-duration-instant) var(--motion-ease-out);
}

.motion-global-progress.is-active { opacity:1; }

.motion-global-progress-bar {
    display:block;
    width:100%;
    height:100%;
    border-radius:0 999px 999px 0;
    transform:scaleX(0);
    transform-origin:left center;
    background:linear-gradient(90deg,#216647,#ed1717,#ffb800);
    box-shadow:0 0 14px rgba(33,102,71,.28);
    transition:transform 180ms linear;
}

.motion-global-progress.is-active .motion-global-progress-bar { will-change:transform; }

.motion-global-progress.is-complete .motion-global-progress-bar {
    transition-duration:var(--motion-duration-instant);
    transition-timing-function:var(--motion-ease-out);
}

button:not(:disabled),
[role="button"],
.button,
.primary-button,
.secondary-button {
    transition-property:background-color,border-color,color,box-shadow,transform,scale,opacity;
    transition-duration:var(--motion-duration-fast);
    transition-timing-function:var(--motion-ease-out);
}

button:not(:disabled):active,
[role="button"]:active,
.button:active,
.primary-button:active,
.secondary-button:active {
    scale:.98;
}

.is-motion-loading {
    position:relative;
    cursor:wait!important;
    pointer-events:none;
}

.is-motion-loading::after {
    content:"";
    display:inline-block;
    width:.9em;
    height:.9em;
    margin-left:.55em;
    border:2px solid currentColor;
    border-right-color:transparent;
    border-radius:50%;
    vertical-align:-.12em;
    animation:motion-spin .65s linear infinite;
}

@keyframes motion-spin {
    to { transform:rotate(360deg); }
}

.motion-lazy-media,
.motion-lazy-frame {
    background-color:#edf1e9;
    background-image:linear-gradient(100deg,transparent 20%,rgba(255,255,255,.8) 48%,transparent 76%);
    background-repeat:no-repeat;
    background-size:220% 100%;
}

.motion-lazy-media.is-loading,
.motion-lazy-frame.is-loading {
    animation:motion-media-loading 1.05s linear infinite;
}

.motion-lazy-media.is-loaded,
.motion-lazy-frame:not(.is-loading) {
    background-image:none;
}

@keyframes motion-media-loading {
    from { background-position:120% 0; }
    to { background-position:-120% 0; }
}

.modal:not([hidden]) .modal-backdrop,
.modal:not([hidden]) .modal-card {
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease-out),
        transform var(--motion-duration-base) var(--motion-ease-out),
        filter var(--motion-duration-fast) var(--motion-ease-out);
}

.modal.is-motion-opening .modal-backdrop { opacity:0; }
.modal.is-motion-opening .modal-card {
    opacity:0;
    transform:translateY(8px) scale(.99);
    filter:blur(2px);
    transform-origin:top center;
}
.modal.is-motion-opening.is-motion-open .modal-backdrop { opacity:1; }
.modal.is-motion-opening.is-motion-open .modal-card {
    opacity:1;
    transform:translateY(0) scale(1);
    filter:blur(0);
}
.modal.is-motion-closing .modal-backdrop { opacity:0; }
.modal.is-motion-closing .modal-card {
    opacity:0;
    transform:translateY(-4px) scale(.995);
    filter:blur(1px);
    transition-duration:var(--motion-duration-instant);
    transition-timing-function:var(--motion-ease-in);
}

.auto-dismiss-success,
.bulk-import-item {
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease-in),
        transform var(--motion-duration-fast) var(--motion-ease-in),
        filter var(--motion-duration-fast) var(--motion-ease-in);
}

.auto-dismiss-success.is-fading-out,
.bulk-import-item.is-fading-out {
    opacity:0;
    transform:translateY(-6px);
    filter:blur(1px);
}

.bulk-import-item.is-loading {
    position:relative;
    overflow:hidden;
    cursor:progress;
}

.bulk-import-item.is-loading::after {
    content:"";
    position:absolute;
    inset:auto 0 0;
    height:3px;
    background:linear-gradient(90deg,#216647,#ffb800,#216647);
    transform:translateX(-70%);
    animation:motion-bulk-progress 1s linear infinite;
    will-change:transform;
}

@keyframes motion-bulk-progress {
    to { transform:translateX(70%); }
}

.analysis-progress-bar {
    transform:scaleX(1);
    transform-origin:right center;
    transition:transform var(--motion-duration-base) var(--motion-ease-out);
    will-change:transform;
}

.panel,
.shell-header,
.area-switcher-panel {
    animation:none!important;
}

.sage-detail-animate {
    max-height:none;
    opacity:0;
    transform:translateY(-4px);
    filter:blur(2px);
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease-out),
        transform var(--motion-duration-base) var(--motion-ease-out),
        filter var(--motion-duration-fast) var(--motion-ease-out);
}

.sage-detail-row.is-open .sage-detail-animate,
.sage-detail-row.is-opening .sage-detail-animate {
    opacity:1;
    transform:translateY(0);
    filter:blur(0);
    animation:none;
}

.floating-control > label,
label.floating-contained > span,
.login-page .auth-form label,
.customer-portal-form label,
.sage-inline-search label > span {
    transition-property:transform,color,opacity;
    transition-duration:var(--motion-duration-fast);
    transition-timing-function:var(--motion-ease-out);
}

.area-switcher-link,
.admin-launch-toggle::before,
.tree-year > summary::before,
.tree-month > summary::before,
.sage-tabs::before,
.sage-sales-controls .sage-type-tabs::before,
.sage-expand-icon,
.sage-sales-controls .sage-payment-legend-items::before,
.customer-document-card-actions a,
.customer-document-card-actions button {
    transition-timing-function:var(--motion-ease-out);
}

.sage-sales-controls .sage-payment-legend-items::before {
    transition-property:transform,opacity,background-color,box-shadow;
}

@media (max-width:760px) {
    .motion-skeleton-screen { padding:14px; }
    .motion-skeleton-layout {
        grid-template-columns:1fr;
        grid-template-rows:78px 28px 16px 260px 150px;
        gap:12px;
    }
    .motion-skeleton-header,
    .motion-skeleton-title,
    .motion-skeleton-copy,
    .motion-skeleton-card-primary,
    .motion-skeleton-card-secondary {
        grid-column:1;
        grid-row:auto;
        width:100%;
        min-height:0;
    }
    .motion-skeleton-title { width:72%; }
    .motion-skeleton-copy { width:54%; }
}

@media (prefers-reduced-motion:reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior:auto!important;
        animation-duration:.01ms!important;
        animation-iteration-count:1!important;
        transition-duration:.01ms!important;
        transition-delay:0s!important;
    }

    html.motion-pending body > .login-shell,
    html.motion-pending body > .page-shell,
    html.motion-pending body > .customer-site-header,
    html.motion-pending body > .customer-portal-shell,
    html.motion-pending body > .system-notices,
    html.motion-exiting body > .login-shell,
    html.motion-exiting body > .page-shell,
    html.motion-exiting body > .customer-site-header,
    html.motion-exiting body > .customer-portal-shell,
    html.motion-exiting body > .system-notices {
        transform:none;
        filter:none;
    }

    .motion-skeleton-layout > span::after,
    .motion-lazy-media.is-loading,
    .motion-lazy-frame.is-loading,
    .bulk-import-item.is-loading::after,
    .is-motion-loading::after {
        animation:none!important;
    }
}

/* Central de Comunicações */
.communications-page .page-shell,
.communications-page .shell {
    width:min(100%,1540px);
    max-width:1540px;
}

.communications-page .shell {
    display:grid;
    gap:18px;
}

.communications-hero {
    min-height:132px;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:44px;
    align-items:center;
    padding:28px 32px;
    position:relative;
    background:#fff;
}

.communications-hero::after {
    content:none;
}

.communications-hero-copy,
.communications-audience-overview {
    position:relative;
    z-index:1;
}

.communications-hero h1 {
    margin:6px 0 5px;
    max-width:780px;
    color:#2b332f;
    font-size:clamp(1.45rem,2vw,1.8rem);
    line-height:1.15;
    letter-spacing:-.025em;
}

.communications-hero p {
    max-width:760px;
    margin:0;
    color:#68736d;
    font-size:.94rem;
    line-height:1.5;
}

.communications-audience-overview {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    align-items:stretch;
}

.communications-audience-overview > div {
    min-width:138px;
    min-height:60px;
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    align-items:center;
    gap:11px;
    padding:4px 25px;
    border-left:1px solid #e1e6e3;
}

.communications-audience-overview svg {
    width:20px;
    height:20px;
    fill:none;
    stroke:#2f7657;
    stroke-linecap:round;
    stroke-linejoin:round;
    stroke-width:1.8;
}

.communications-audience-overview span {
    display:grid;
    gap:3px;
}

.communications-audience-overview small {
    color:#718078;
    font-size:.68rem;
    font-weight:750;
    line-height:1.2;
}

.communications-audience-overview strong {
    color:#27342d;
    font-size:1.22rem;
    line-height:1;
}

.communications-channel-tabs {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}

.communications-channel-card {
    min-height:112px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
    padding:22px 26px;
    border:1px solid #d8e2dc;
    border-radius:22px;
    color:#2d342f;
    background:rgba(255,255,255,.9);
    box-shadow:0 14px 36px rgba(24,48,37,.06);
    text-decoration:none;
    transition:transform var(--motion-duration-fast) var(--motion-ease-out),border-color var(--motion-duration-fast) var(--motion-ease-out),box-shadow var(--motion-duration-fast) var(--motion-ease-out),background-color var(--motion-duration-fast) var(--motion-ease-out);
}

.communications-channel-card:hover {
    transform:translateY(-2px);
    border-color:#86b39d;
    box-shadow:0 18px 42px rgba(24,75,52,.11);
}

.communications-channel-card.is-active {
    border-color:#2f7657;
    background:linear-gradient(135deg,#eaf7f0 0%,#fff 76%);
    box-shadow:inset 4px 0 #147554,0 18px 42px rgba(24,75,52,.1);
}

.communications-channel-card > span:first-child {
    display:grid;
    gap:5px;
}

.communications-channel-card strong {
    font-size:1.12rem;
}

.communications-channel-card small {
    color:#6f7772;
    font-size:.88rem;
}

.communications-channel-icon {
    flex:0 0 auto;
    font-size:2.3rem;
    line-height:1;
    filter:drop-shadow(0 8px 12px rgba(24,48,37,.12));
}

.communications-composer,
.communications-progress-panel,
.communications-history-panel {
    padding:30px;
}

.communications-section-heading,
.communications-progress-heading {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:24px;
    margin-bottom:24px;
}

.communications-section-heading h2,
.communications-progress-heading h2 {
    margin:5px 0 6px;
    color:#1d2922;
    font-size:1.65rem;
}

.communications-section-heading p {
    margin:0;
    color:#707a74;
}

.communications-ready-pill {
    flex:0 0 auto;
    display:inline-flex;
    align-items:center;
    min-height:40px;
    padding:8px 15px;
    border:1px solid #d6e2db;
    border-left:4px solid #2b7051;
    border-radius:999px;
    color:#28553f;
    background:#f5faf7;
    font-size:.78rem;
    font-weight:850;
}

.communications-ready-pill.is-missing {
    border-color:#f0c4c4;
    border-left-color:#c93434;
    color:#a22222;
    background:#fff4f4;
}

.communications-form {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:18px;
    align-items:stretch;
}

.communications-editor {
    border:1px solid #dbe4de;
    border-radius:20px;
}

.communications-editor {
    display:grid;
    gap:18px;
    align-content:start;
    padding:24px;
    background:#fff;
}

.communications-editor.has-phone-preview {
    grid-template-columns:minmax(0,4fr) minmax(250px,1fr);
    grid-template-areas:
        "sms-mode preview"
        "message preview"
        "template-tools preview";
    align-items:start;
}

.communications-editor.has-email-preview {
    grid-template-columns:minmax(0,7fr) minmax(340px,3fr);
    grid-template-areas:
        "subject preview"
        "message preview"
        "template-tools preview";
    align-items:start;
}

.communications-editor.has-email-preview > .communications-subject-field {
    grid-area:subject;
}

.communications-editor.has-email-preview > .communications-message-field {
    grid-area:message;
}

.communications-editor.has-email-preview > .communications-template-tools {
    grid-area:template-tools;
}

.communications-editor.has-email-preview > .communications-live-preview {
    grid-area:preview;
    align-self:stretch;
    min-width:0;
}

.communications-editor.has-phone-preview > .communications-sms-mode {
    grid-area:sms-mode;
}

.communications-editor.has-phone-preview > .communications-message-field {
    grid-area:message;
}

.communications-editor.has-phone-preview > .communications-template-tools {
    grid-area:template-tools;
}

.communications-editor.has-phone-preview > .communications-live-preview {
    grid-area:preview;
    align-self:stretch;
    min-width:0;
}

.communications-editor.has-phone-preview .communications-preview-heading,
.communications-editor.has-email-preview .communications-preview-heading {
    align-items:flex-start;
    flex-direction:column;
    gap:6px;
}

.communications-editor.has-phone-preview .communications-preview-heading small,
.communications-editor.has-email-preview .communications-preview-heading small {
    width:100%;
    max-width:100%;
}

.communications-editor.has-phone-preview .communications-phone-preview {
    width:min(calc(100% - 24px),240px);
    margin:16px auto 18px;
}

.communications-message-field textarea {
    min-height:250px;
    resize:vertical;
    line-height:1.55;
}

.communications-template-tools {
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:8px;
    color:#6b756f;
    font-size:.78rem;
    font-weight:750;
}

.communications-template-tools button {
    min-height:32px;
    width:auto;
    padding:5px 10px;
    border:1px solid #c8d9cf;
    border-radius:999px;
    color:#246045;
    background:#f5faf7;
    font:inherit;
    font-weight:800;
}

.communications-template-tools button:hover {
    color:#fff;
    background:#246045;
}

.communications-sms-counter {
    margin-left:auto;
    color:#526259;
    font-weight:800;
}

.communications-sms-counter.is-over-limit {
    color:#bd2020;
}

.communications-live-preview {
    overflow:hidden;
    border:1px solid #d9e4de;
    border-radius:18px;
    background:linear-gradient(145deg,#f7faf8,#f0f5f2);
}

.communications-preview-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    padding:15px 18px;
    border-bottom:1px solid #dde6e0;
}

.communications-preview-heading > div {
    display:grid;
    gap:2px;
}

.communications-preview-heading span {
    color:#c7352e;
    font-size:.66rem;
    font-weight:900;
    letter-spacing:.09em;
    text-transform:uppercase;
}

.communications-preview-heading h3 {
    margin:0;
    color:#24332b;
    font-size:1rem;
}

.communications-preview-heading small {
    max-width:45%;
    overflow:hidden;
    color:#66736c;
    font-weight:750;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.communications-email-preview {
    margin:18px;
    overflow:hidden;
    border:1px solid #d8ddd9;
    border-radius:14px;
    background:#fff;
    box-shadow:0 14px 34px rgba(34,64,49,.08);
}

.communications-email-preview-bar {
    display:grid;
    grid-template-columns:8px 8px 8px minmax(0,1fr);
    align-items:center;
    gap:6px;
    min-height:42px;
    padding:8px 14px;
    border-bottom:1px solid #e5e8e6;
    background:#f5f3f0;
}

.communications-email-preview-bar i {
    width:8px;
    height:8px;
    border-radius:50%;
    background:#d4c8bd;
}

.communications-email-preview-bar i:first-child { background:#ef827b; }
.communications-email-preview-bar i:nth-child(2) { background:#f1bd69; }
.communications-email-preview-bar i:nth-child(3) { background:#77b98f; }

.communications-email-preview-bar strong {
    min-width:0;
    margin-left:7px;
    overflow:hidden;
    color:#4d5651;
    font-size:.8rem;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.communications-email-preview-body {
    min-height:155px;
    padding:0;
}

.communications-email-preview-brand {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:16px 18px;
    border-bottom:1px solid #e5ebe7;
    background:#f8fbf9;
}

.communications-email-preview-brand img {
    width:132px;
    height:auto;
}

.communications-email-preview-brand span {
    color:#69766f;
    font-size:.65rem;
    font-weight:900;
    letter-spacing:.065em;
    text-align:right;
    text-transform:uppercase;
}

.communications-email-preview-body p,
.communications-confirm-preview p {
    margin:0;
    color:#3e4943;
    line-height:1.55;
    white-space:pre-wrap;
}

.communications-email-preview-body > p {
    min-height:170px;
    padding:20px 18px;
    overflow-wrap:anywhere;
}

.communications-email-preview-footer {
    display:grid;
    gap:4px;
    padding:15px 18px;
    color:#fff;
    background:linear-gradient(135deg,#1f513d,#2b7053);
}

.communications-email-preview-footer strong {
    font-size:.8rem;
}

.communications-email-preview-footer span {
    color:rgba(255,255,255,.76);
    font-size:.67rem;
    line-height:1.4;
}

.communications-phone-preview {
    position:relative;
    width:min(100%,315px);
    aspect-ratio:2/3;
    margin:18px auto;
    isolation:isolate;
}

.communications-phone-hardware {
    position:absolute;
    z-index:1;
    inset:0;
    width:100%;
    height:100%;
    object-fit:contain;
    clip-path:inset(2.6% 14% 2.6% 14% round 12% / 8%);
    filter:drop-shadow(0 20px 22px rgba(20,48,34,.22));
    pointer-events:none;
    user-select:none;
}

.communications-phone-screen {
    position:absolute;
    z-index:2;
    top:4.8%;
    right:18.3%;
    bottom:4.8%;
    left:18.3%;
    display:flex;
    min-width:0;
    flex-direction:column;
    padding:14% 7% 7%;
    overflow:hidden;
    border-radius:12% / 6%;
    color:#26332c;
}

.communications-phone-status {
    position:absolute;
    top:3.2%;
    right:7%;
    left:7%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    color:#26332c;
    font-size:.48rem;
    font-weight:850;
}

.communications-phone-chat-header {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    padding:0 2% 9%;
    border-bottom:1px solid rgba(38,51,44,.11);
    text-align:left;
}

.communications-phone-chat-header > span:last-child {
    display:grid;
    min-width:0;
    gap:1px;
}

.communications-phone-chat-header strong {
    overflow:hidden;
    color:#1f2c25;
    font-size:.68rem;
    line-height:1.1;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.communications-phone-chat-header small {
    color:#6d7871;
    font-size:.43rem;
    line-height:1.25;
}

.communications-phone-sender-avatar {
    flex:0 0 auto;
    display:grid;
    width:27px;
    height:27px;
    place-items:center;
    border-radius:50%;
    color:#fff;
    background:linear-gradient(145deg,#28684d,#43946f);
    font-size:.72rem;
    font-weight:900;
}

.communications-phone-conversation {
    display:flex;
    min-height:0;
    flex:1 1 auto;
    flex-direction:column;
    align-items:flex-start;
    padding:12% 0 7%;
    overflow:auto;
    scrollbar-width:thin;
}

.communications-phone-conversation p {
    max-width:92%;
    margin:0;
    padding:9px 10px;
    border-radius:5px 13px 13px 13px;
    color:#203028;
    background:rgba(255,255,255,.94);
    box-shadow:0 7px 16px rgba(26,62,44,.1);
    font-size:.62rem;
    line-height:1.42;
    white-space:pre-wrap;
}

.communications-phone-conversation time {
    margin:4px 0 0 5px;
    color:#7b847f;
    font-size:.42rem;
}

.communications-phone-recipient {
    display:block;
    min-width:0;
    padding-top:6%;
    overflow:hidden;
    border-top:1px solid rgba(38,51,44,.1);
    color:#727d76;
    font-size:.44rem;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.communications-phone-recipient strong {
    color:#45534b;
    font-weight:800;
}

.communications-recipient-directory {
    margin-top:22px;
    padding-top:22px;
    border-top:1px solid #e1e8e4;
}

.communications-recipient-directory-head {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(300px,420px);
    align-items:end;
    gap:22px;
    margin-bottom:16px;
}

.communications-recipient-directory-head h3 {
    margin:4px 0;
    color:#223129;
    font-size:1.2rem;
}

.communications-recipient-directory-head p {
    margin:0;
    color:#747d78;
    font-size:.8rem;
}

.communications-recipient-search {
    display:grid;
    gap:5px;
    color:#73675f;
    font-size:.7rem;
    font-weight:850;
    letter-spacing:.035em;
    text-transform:uppercase;
}

.communications-recipient-search input {
    width:100%;
    min-height:48px;
    padding:10px 14px;
    border:1px solid #d8cec1;
    border-radius:13px;
    color:#26332c;
    background:#fff;
    font:inherit;
    font-size:.88rem;
    font-weight:650;
    letter-spacing:0;
    text-transform:none;
}

.communications-recipient-search input:focus {
    border-color:var(--magi-green-2);
    outline:0;
    box-shadow:0 0 0 4px rgba(52,116,85,.12);
}

.communications-recipient-list {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
}

.communications-recipient-list[aria-busy="true"] {
    opacity:.45;
}

.communications-recipient-row {
    min-width:0;
    display:grid;
    grid-template-columns:38px minmax(0,1fr) minmax(145px,auto);
    align-items:center;
    gap:11px;
    min-height:66px;
    padding:10px 13px;
    border:1px solid #e1e7e3;
    border-radius:13px;
    background:#fff;
}

.communications-recipient-avatar {
    width:38px;
    height:38px;
    display:grid;
    place-items:center;
    border-radius:12px;
    color:#285a43;
    background:#e9f4ed;
    font-weight:900;
}

.communications-recipient-row > span:nth-child(2) {
    min-width:0;
    display:grid;
    gap:3px;
}

.communications-recipient-row strong,
.communications-recipient-row small,
.communications-recipient-row em {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.communications-recipient-row strong {
    color:#27352e;
    font-size:.82rem;
}

.communications-recipient-row small,
.communications-recipient-row em {
    color:#758079;
    font-size:.7rem;
}

.communications-recipient-row em {
    font-style:normal;
    text-align:right;
}

.communications-recipient-empty {
    grid-column:1/-1;
    margin:0;
    padding:30px;
    border:1px dashed #cdd9d2;
    border-radius:14px;
    color:#727d76;
    text-align:center;
}

.communications-sms-mode {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    padding:0;
    border:0;
}

.communications-sms-mode legend {
    grid-column:1/-1;
    margin-bottom:3px;
    color:#75675e;
    font-size:.74rem;
    font-weight:850;
    letter-spacing:.04em;
    text-transform:uppercase;
}

.communications-sms-mode label {
    position:relative;
    display:flex;
    min-height:78px;
    align-items:center;
    gap:12px;
    padding:14px;
    border:1px solid #d9cec1;
    border-radius:14px;
    cursor:pointer;
    background:#fffdfa;
}

.communications-sms-mode label:has(input:checked) {
    border-color:#19856a;
    box-shadow:inset 3px 0 #19856a;
    background:#edf8f3;
}

.communications-sms-mode input {
    width:18px;
    height:18px;
    accent-color:#187a60;
}

.communications-sms-mode label span {
    display:grid;
    gap:3px;
}

.communications-sms-mode small {
    color:#756a62;
}

.communications-form-actions {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:14px;
}

.communications-bulk-authorization {
    width:100%;
    min-height:70px;
    display:flex;
    align-items:center;
    gap:14px;
    padding:14px 18px;
    border:1px solid #cedbd4;
    border-radius:12px;
    color:#2c3831;
    background:#f7faf8;
    cursor:pointer;
    transition:transform var(--motion-duration-fast) var(--motion-ease-out);
}

.communications-bulk-authorization:hover {
    transform:translateY(-1px);
}

.communications-bulk-authorization:has(input:checked) {
    border-color:#76a48e;
    background:#edf6f1;
    box-shadow:inset 3px 0 #2f7657;
}

.communications-bulk-authorization:has(input:focus-visible) {
    outline:3px solid rgba(47,118,87,.18);
    outline-offset:2px;
}

.communications-bulk-authorization:has(input:disabled) {
    opacity:.55;
    cursor:not-allowed;
    transform:none;
}

.communications-bulk-authorization input {
    flex:0 0 auto;
    width:19px;
    height:19px;
    margin:0;
    accent-color:#2f7657;
}

.communications-bulk-authorization span {
    display:grid;
    gap:3px;
}

.communications-bulk-authorization strong {
    color:#29362f;
    font-size:.9rem;
    line-height:1.25;
}

.communications-bulk-authorization small {
    color:#6d7872;
    font-size:.76rem;
    font-weight:650;
    line-height:1.4;
}

.communications-submit {
    width:auto;
    min-width:220px;
    justify-self:end;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    border-color:var(--magi-green);
    color:#fff;
    background:linear-gradient(135deg,var(--magi-green),var(--magi-green-2));
    box-shadow:0 12px 24px rgba(36,82,60,.18);
    transition:transform var(--motion-duration-fast) var(--motion-ease-out),opacity var(--motion-duration-fast) var(--motion-ease-out);
}

.communications-submit:hover:not(:disabled) {
    transform:translateY(-1px);
    border-color:#1f4935;
    color:#fff;
    background:linear-gradient(135deg,#1f4935,#2d684c);
}

.communications-submit:active:not(:disabled) {
    transform:scale(.98);
}

.communications-submit-icon {
    font-size:1rem;
    line-height:1;
}

.communications-submit.is-submitting {
    opacity:.72;
}

.communications-submit:disabled {
    opacity:.45;
    cursor:not-allowed;
}

.communications-test-form {
    display:grid;
    grid-template-columns:minmax(260px,.8fr) minmax(300px,1fr) auto;
    align-items:end;
    gap:16px;
    margin-top:22px;
    padding:18px;
    border:1px solid #dce6e0;
    border-radius:17px;
    background:#f6f9f7;
}

.communications-test-copy {
    display:grid;
    align-self:center;
    gap:3px;
}

.communications-test-copy strong {
    color:#24322b;
    font-size:.95rem;
}

.communications-test-copy small {
    color:#707b74;
    font-size:.75rem;
    line-height:1.4;
}

.communications-test-recipient {
    display:grid;
    gap:6px;
    color:#73675f;
    font-size:.7rem;
    font-weight:850;
    letter-spacing:.035em;
    text-transform:uppercase;
}

.communications-test-recipient input {
    width:100%;
    min-height:50px;
    padding:10px 14px;
    border:1px solid #d8cec1;
    border-radius:13px;
    color:#26332c;
    background:#fff;
    font:inherit;
    font-size:.88rem;
    font-weight:650;
    letter-spacing:0;
    text-transform:none;
}

.communications-test-recipient input:focus {
    border-color:var(--magi-green-2);
    outline:0;
    box-shadow:0 0 0 4px rgba(52,116,85,.12);
}

.communications-test-button {
    min-width:150px;
    min-height:50px;
}

.communications-status {
    display:inline-flex;
    align-items:center;
    min-height:32px;
    padding:6px 11px;
    border-radius:999px;
    color:#325346;
    background:#edf5f0;
    font-size:.72rem;
    font-weight:850;
    white-space:nowrap;
}

.communications-status.is-processing,
.communications-status.is-queued {
    color:#8b5a06;
    background:#fff2d8;
}

.communications-status.is-completed {
    color:#11643e;
    background:#e3f7eb;
}

.communications-status.is-completed_with_errors {
    color:#aa5a0b;
    background:#fff0dc;
}

.communications-status.is-cancelled {
    color:#8a2a2a;
    background:#fde8e8;
}

.communications-progress-track {
    appearance:none;
    border:0;
    width:100%;
    height:12px;
    overflow:hidden;
    border-radius:999px;
    background:#e6ede9;
}

.communications-progress-track::-webkit-progress-bar,
.communications-mini-progress::-webkit-progress-bar {
    border-radius:999px;
    background:#e6ede9;
}

.communications-progress-track::-webkit-progress-value {
    border-radius:999px;
    background:linear-gradient(90deg,#166346,#39a474);
    box-shadow:0 0 18px rgba(33,133,91,.32);
}

.communications-progress-track::-moz-progress-bar {
    border-radius:999px;
    background:linear-gradient(90deg,#166346,#39a474);
    box-shadow:0 0 18px rgba(33,133,91,.32);
}

.communications-progress-meta {
    display:flex;
    flex-wrap:wrap;
    gap:18px 28px;
    margin-top:14px;
    color:#6e7972;
    font-size:.82rem;
}

.communications-progress-meta strong {
    color:#26372e;
}

.communications-progress-message {
    margin:18px 0 0;
    color:#647068;
}

.communications-progress-actions {
    display:flex;
    justify-content:flex-end;
    gap:10px;
    margin-top:18px;
}

.communications-progress-actions button {
    width:auto;
    min-width:170px;
}

.communications-history-table-wrap {
    overflow:auto;
    border:1px solid #dce4df;
    border-radius:18px;
}

.communications-history-table {
    width:100%;
    min-width:940px;
    border-collapse:collapse;
}

.communications-history-table th,
.communications-history-table td {
    padding:14px 16px;
    border-bottom:1px solid #ece2d7;
    text-align:left;
    vertical-align:middle;
}

.communications-history-table th {
    color:#625b55;
    background:#fbf7f1;
    font-size:.73rem;
    letter-spacing:.035em;
    text-transform:uppercase;
}

.communications-history-table tbody tr:last-child td {
    border-bottom:0;
}

.communications-history-table td {
    font-size:.86rem;
}

.communications-history-table td > small {
    display:block;
    margin-top:3px;
    color:#7b837e;
}

.communications-mini-progress {
    appearance:none;
    border:0;
    width:150px;
    height:6px;
    display:block;
    overflow:hidden;
    margin-bottom:5px;
    border-radius:999px;
    background:#e6ede9;
}

.communications-mini-progress::-webkit-progress-value,
.communications-mini-progress::-moz-progress-bar {
    border-radius:999px;
    background:#2d8a63;
}

.communications-view-link {
    min-height:34px;
    padding:7px 13px;
}

.communications-empty-state {
    min-height:190px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:7px;
    padding:28px 20px;
    border:1px solid #d7e2dc;
    border-radius:18px;
    color:#6f7a74;
    text-align:center;
    background:linear-gradient(145deg,#fbfdfb,#f4f8f5);
}

.communications-empty-state-icon {
    width:42px;
    height:42px;
    margin-bottom:3px;
    color:#267354;
    filter:drop-shadow(0 7px 11px rgba(38,115,84,.14));
}

.communications-empty-state-icon path {
    fill:none;
    stroke:currentColor;
    stroke-width:2.6;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.communications-empty-state strong {
    color:#24332b;
    font-size:1rem;
}

.communications-empty-state span {
    font-size:.9rem;
    line-height:1.45;
}

.communications-confirm-summary {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin:22px 0;
}

.communications-confirm-summary span {
    display:grid;
    gap:4px;
    padding:14px;
    border:1px solid #dce7e0;
    border-radius:14px;
    background:#f7faf8;
}

.communications-confirm-summary small {
    color:#79827d;
    font-size:.68rem;
    font-weight:800;
    letter-spacing:.05em;
    text-transform:uppercase;
}

.communications-confirm-summary strong {
    color:#274b39;
    font-size:.9rem;
}

.communications-confirm-preview {
    max-height:180px;
    overflow:auto;
    display:grid;
    gap:8px;
    margin-top:16px;
    padding:15px 17px;
    border:1px solid #dce5df;
    border-left:4px solid var(--magi-green-2);
    border-radius:12px;
    background:#f5f8f6;
}

.communications-confirm-preview > strong {
    color:#26372e;
}

.communications-confirm-preview p {
    font-size:.84rem;
}

@media (max-width:1100px) {
    .communications-hero,
    .communications-form {
        grid-template-columns:1fr;
    }
    .communications-editor.has-phone-preview {
        grid-template-columns:1fr;
        grid-template-areas:
            "sms-mode"
            "message"
            "template-tools"
            "preview";
    }
    .communications-editor.has-email-preview {
        grid-template-columns:1fr;
        grid-template-areas:
            "subject"
            "message"
            "template-tools"
            "preview";
    }
    .communications-editor.has-phone-preview .communications-preview-heading,
    .communications-editor.has-email-preview .communications-preview-heading {
        align-items:center;
        flex-direction:row;
        gap:18px;
    }
    .communications-editor.has-phone-preview .communications-preview-heading small,
    .communications-editor.has-email-preview .communications-preview-heading small {
        width:auto;
        max-width:45%;
    }
    .communications-editor.has-phone-preview .communications-phone-preview {
        width:min(100%,315px);
        margin:18px auto;
    }
    .communications-audience-overview {
        padding-top:18px;
        border-top:1px solid #e1e6e3;
    }
    .communications-audience-overview > div:first-child {
        border-left:0;
    }
}

@media (max-width:760px) {
    .communications-hero,
    .communications-composer,
    .communications-progress-panel,
    .communications-history-panel {
        padding:22px 18px;
    }
    .communications-channel-tabs,
    .communications-audience-overview,
    .communications-sms-mode,
    .communications-confirm-summary,
    .communications-recipient-list,
    .communications-recipient-directory-head {
        grid-template-columns:1fr;
    }
    .communications-section-heading,
    .communications-progress-heading {
        align-items:flex-start;
        flex-direction:column;
    }
    .communications-template-tools,
    .communications-progress-meta {
        align-items:flex-start;
        flex-direction:column;
    }
    .communications-editor.has-phone-preview .communications-preview-heading,
    .communications-editor.has-email-preview .communications-preview-heading {
        align-items:flex-start;
        flex-direction:column;
        gap:6px;
    }
    .communications-editor.has-phone-preview .communications-preview-heading small,
    .communications-editor.has-email-preview .communications-preview-heading small {
        width:100%;
        max-width:100%;
    }
    .communications-sms-counter {
        margin-left:0;
    }
    .communications-progress-actions {
        align-items:stretch;
        flex-direction:column;
    }
    .communications-progress-actions button {
        width:100%;
    }
    .communications-form-actions,
    .communications-bulk-authorization,
    .communications-submit,
    .communications-test-button {
        width:100%;
    }
    .communications-form-actions {
        grid-template-columns:1fr;
    }
    .communications-submit {
        justify-self:stretch;
    }
    .communications-audience-overview {
        gap:0;
    }
    .communications-audience-overview > div,
    .communications-audience-overview > div:first-child {
        min-height:54px;
        padding:10px 0;
        border-top:1px solid #e7ebe9;
        border-left:0;
    }
    .communications-audience-overview > div:first-child {
        border-top:0;
    }
    .communications-test-form {
        grid-template-columns:1fr;
    }
    .communications-recipient-row {
        grid-template-columns:38px minmax(0,1fr);
    }
    .communications-recipient-row em {
        grid-column:2;
        text-align:left;
    }
}

@media (prefers-reduced-motion:reduce) {
    .communications-bulk-authorization,
    .communications-submit {
        transition:none;
    }
    .communications-bulk-authorization:hover,
    .communications-submit:hover:not(:disabled),
    .communications-submit:active:not(:disabled) {
        transform:none;
    }
}
