﻿html, body {
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--mud-palette-background);
}

body {
    margin: 0;
}

.app-logo {
    display: block;
    width: auto;
    object-fit: contain;
}

.app-logo-topbar {
    height: 34px;
    max-width: 220px;
}

.login-brand {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.login-logo {
    height: 72px;
    max-width: 320px;
}

.login-mobile-logo-img {
    height: 58px;
    max-width: 240px;
}

.app-loading-logo {
    height: 64px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
    margin-bottom: 24px;
}


.app-loading-shell {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34%),
        linear-gradient(135deg, #f5f7fb 0%, #eef4ff 52%, #f6f8fc 100%);
    transition: opacity 0.18s ease, visibility 0.18s ease;
}

.app-loading-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loading-panel {
    width: min(100%, 460px);
    padding: 40px 32px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 30px 80px rgba(10, 18, 48, 0.28);
    text-align: center;
}

.app-loading-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 18px;
    border-radius: 999px;
    border: 3px solid rgba(57, 88, 255, 0.16);
    border-top-color: #2563eb;
    animation: seam-app-spin 0.9s linear infinite;
}

.app-loading-title {
    color: #18213b;
    font-size: 1.15rem;
    font-weight: 700;
}

.app-loading-subtitle {
    margin-top: 8px;
    color: #667085;
    font-size: 0.96rem;
    line-height: 1.5;
}

html.seam-dark .app-loading-shell {
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 34%),
        linear-gradient(135deg, #080d18 0%, #0f172a 100%);
}

html.seam-dark .app-loading-panel {
    background: rgba(15, 23, 42, 0.94);
}

html.seam-dark .app-loading-title {
    color: #f8fafc;
}

html.seam-dark .app-loading-subtitle {
    color: #94a3b8;
}

@keyframes seam-app-spin {
    to { transform: rotate(360deg); }
}

.login-shell {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    padding: 32px;
    background:
        radial-gradient(circle at 18% 12%, rgba(37, 99, 235, 0.16), transparent 28%),
        radial-gradient(circle at 80% 78%, rgba(20, 184, 166, 0.13), transparent 30%),
        linear-gradient(135deg, #f5f7fb 0%, #eef4ff 50%, #f8fafc 100%);
}

.login-shell-simple {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    padding: 34px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 18px !important;
    background: var(--mud-palette-surface) !important;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.16) !important;
}

.login-title {
    font-weight: 800 !important;
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.login-submit {
    min-height: 52px;
    border-radius: 16px !important;
    text-transform: none !important;
    font-weight: 700 !important;
}

.login-mobile-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.stat-value {
    font-weight: 700;
}

.card-top-primary { border-top: 3px solid var(--mud-palette-primary); }
.card-top-success { border-top: 3px solid var(--mud-palette-success); }
.card-top-warning { border-top: 3px solid var(--mud-palette-warning); }
.card-top-error { border-top: 3px solid var(--mud-palette-error); }

.metric-tile {
    min-height: 118px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-left: 4px solid var(--mud-palette-primary);
}
.metric-tile.metric-success { border-left-color: var(--mud-palette-success); }
.metric-tile.metric-warning { border-left-color: var(--mud-palette-warning); }
.metric-tile.metric-error { border-left-color: var(--mud-palette-error); }
.metric-icon { font-size: 30px !important; opacity: .8; }
.metric-value { font-weight: 800 !important; margin: 2px 0 !important; }
.dashboard-header {
    gap: 16px;
}
.dashboard-title {
    min-width: 0;
}
.dashboard-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.dashboard-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}
.dashboard-action {
    min-width: max-content;
}
.clients-header {
    gap: 12px;
}
.clients-title {
    min-width: 0;
}
.clients-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.clients-search {
    width: min(100%, 280px);
}
.clients-new-button {
    min-width: max-content;
}
.projects-header {
    gap: 12px;
}
.projects-title {
    min-width: 0;
}
.projects-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.projects-filter {
    width: min(100%, 280px);
}
.projects-new-button {
    min-width: max-content;
}
.jobs-header {
    gap: 12px;
}
.jobs-title {
    min-width: 0;
}
.jobs-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.jobs-filter {
    width: min(100%, 280px);
}
.jobs-new-button {
    min-width: max-content;
}
.invoices-header {
    gap: 12px;
}
.invoices-title {
    min-width: 0;
}
.invoices-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.invoices-filter {
    width: min(100%, 280px);
}
.invoices-new-button {
    min-width: max-content;
}
.imported-invoices-header {
    gap: 12px;
}
.imported-invoices-title {
    min-width: 0;
}
.imported-invoices-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.imported-invoices-upload-button {
    min-width: max-content;
}
.payments-header {
    gap: 12px;
}
.payments-title {
    min-width: 0;
}
.payments-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.payments-filter {
    width: min(100%, 280px);
}
.payments-new-button {
    min-width: max-content;
}
.reports-header {
    gap: 12px;
}
.reports-header > div {
    min-width: 0;
}
.reports-header .mud-typography-h4 {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.reports-filter-control {
    width: min(100%, 180px);
}
.reports-filter-control.mud-select {
    width: min(100%, 220px);
}
.reports-currency-filter.mud-select {
    width: min(100%, 130px);
}
.audit-logs-header {
    gap: 12px;
}
.audit-logs-title {
    min-width: 0;
}
.audit-logs-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.settings-header {
    gap: 12px;
}
.settings-title {
    min-width: 0;
}
.settings-title-text {
    font-weight: 800 !important;
    overflow-wrap: anywhere;
}
.settings-header-action {
    min-width: max-content;
}
.settings-danger-zone {
    border-color: color-mix(in srgb, var(--mud-palette-error) 35%, var(--mud-palette-lines-default)) !important;
}
.settings-danger-copy {
    min-width: 0;
}
.section-panel, .report-section, .currency-summary { padding: 18px; }
.section-heading, .report-section-header { padding-bottom: 12px; border-bottom: 1px solid var(--mud-palette-divider); }
.operations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.operation-item { display: flex; gap: 10px; align-items: center; padding: 12px; color: inherit; text-decoration: none; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; }
.operation-item:hover { border-color: var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 5%, transparent); }
.operation-item div { display: flex; flex-direction: column; }
.operation-item strong { font-size: 1.15rem; }
.operation-item span { color: var(--mud-palette-text-secondary); font-size: .75rem; }
.report-filter-bar { padding: 12px 16px; border-left: 4px solid var(--mud-palette-primary); }

.audit-logs-pager {
    gap: 12px;
}

.audit-logs-page-size {
    width: 92px;
    flex: 0 0 92px;
}
.currency-summary { min-height: 174px; }

@media (max-width: 760px) {
    .dashboard-page {
        padding: 16px !important;
    }

    .dashboard-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .dashboard-header > .mud-spacer {
        display: none;
    }

    .dashboard-title {
        flex: 1 1 100%;
        width: 100%;
    }

    .dashboard-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .dashboard-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .dashboard-actions {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr));
        width: 100%;
        gap: 8px !important;
        justify-content: stretch;
    }

    .dashboard-action {
        width: 100%;
        min-width: 0;
    }

    .clients-page {
        padding: 16px !important;
    }

    .clients-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .clients-header > .mud-spacer {
        display: none;
    }

    .clients-title,
    .clients-search,
    .clients-inactive-switch,
    .clients-new-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .clients-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .clients-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .clients-search {
        max-width: none;
    }

    .clients-inactive-switch {
        margin: 0 !important;
    }

    .clients-new-button {
        min-width: 0;
    }

    .clients-table-panel {
        padding: 12px !important;
    }

    .projects-page {
        padding: 16px !important;
    }

    .projects-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .projects-header > .mud-spacer {
        display: none;
    }

    .projects-title,
    .projects-filter,
    .projects-new-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .projects-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .projects-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .projects-filter {
        max-width: none;
    }

    .projects-new-button {
        min-width: 0;
    }

    .projects-table-panel {
        padding: 12px !important;
    }

    .jobs-page {
        padding: 16px !important;
    }

    .jobs-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .jobs-header > .mud-spacer {
        display: none;
    }

    .jobs-title,
    .jobs-filter,
    .jobs-new-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .jobs-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .jobs-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .jobs-filter {
        max-width: none;
    }

    .jobs-new-button {
        min-width: 0;
    }

    .jobs-table-panel {
        padding: 12px !important;
    }

    .invoices-page {
        padding: 16px !important;
    }

    .invoices-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .invoices-header > .mud-spacer {
        display: none;
    }

    .invoices-title,
    .invoices-filter,
    .invoices-new-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .invoices-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .invoices-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .invoices-filter {
        max-width: none;
    }

    .invoices-new-button {
        min-width: 0;
    }

    .invoices-table-panel {
        padding: 12px !important;
    }

    .imported-invoices-page {
        padding: 16px !important;
    }

    .imported-invoices-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .imported-invoices-header > .mud-spacer {
        display: none;
    }

    .imported-invoices-title,
    .imported-invoices-upload-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .imported-invoices-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .imported-invoices-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .imported-invoices-upload-button {
        min-width: 0;
    }

    .imported-invoices-filter-panel,
    .imported-invoices-table-panel {
        padding: 12px !important;
    }

    .imported-invoices-filter-item,
    .imported-invoices-filter-actions-item {
        width: 100%;
    }

    .imported-invoices-filter-actions {
        width: 100%;
        justify-content: flex-end !important;
    }

    .payments-page {
        padding: 16px !important;
    }

    .payments-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .payments-header > .mud-spacer {
        display: none;
    }

    .payments-title,
    .payments-filter,
    .payments-new-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .payments-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .payments-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .payments-filter {
        max-width: none;
    }

    .payments-new-button {
        min-width: 0;
    }

    .payments-table-panel {
        padding: 12px !important;
    }

    .reports-page {
        padding: 16px !important;
    }

    .reports-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .reports-header > .mud-spacer {
        display: none;
    }

    .reports-header > div {
        flex: 1 1 100%;
        width: 100%;
    }

    .reports-header .mud-typography-h4 {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .reports-header .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .reports-header .mud-menu,
    .reports-header .mud-button-root {
        width: 100%;
    }

    .report-filter-bar {
        padding: 12px !important;
    }

    .reports-filter-stack {
        align-items: stretch !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    .reports-filter-stack > * {
        flex: 1 1 100% !important;
        max-width: none !important;
    }

    .report-filter-bar .mud-icon-root,
    .report-filter-bar .mud-spacer {
        display: none;
    }

    .reports-filter-control,
    .reports-filter-control.mud-select,
    .reports-currency-filter.mud-select,
    .reports-filter-stack .mud-button-root,
    .reports-filter-stack .mud-typography-caption {
        width: 100%;
    }

    .report-section {
        padding: 12px !important;
    }

    .report-section-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        gap: 10px;
    }

    .report-section-header > .mud-spacer {
        display: none;
    }

    .report-section-header > div,
    .report-section-header .mud-button-root {
        width: 100%;
    }

    .audit-logs-page {
        padding: 16px !important;
    }

    .audit-logs-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .audit-logs-header > .mud-spacer {
        display: none;
    }

    .audit-logs-title,
    .audit-logs-header .mud-button-root {
        flex: 1 1 100%;
        width: 100%;
    }

    .audit-logs-title-text {
        font-size: clamp(1.65rem, 9vw, 2rem) !important;
        line-height: 1.08 !important;
    }

    .audit-logs-title .mud-typography-body1 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .audit-logs-filter-panel,
    .audit-logs-table-panel {
        padding: 12px !important;
    }

    .audit-logs-filter-item,
    .audit-logs-filter-actions-item {
        width: 100%;
    }

    .audit-logs-filter-actions {
        width: 100%;
        justify-content: flex-end !important;
    }

    .audit-logs-pager {
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .audit-logs-pager .mud-typography-caption {
        flex: 1 1 100%;
        text-align: center;
    }

    .audit-logs-pager .mud-pagination {
        flex: 1 1 auto;
        justify-content: center;
    }

    .audit-logs-page-size {
        width: 86px;
        flex: 0 0 86px;
    }

    .settings-page {
        padding: 16px !important;
    }

    .settings-header {
        align-items: flex-start !important;
        flex-wrap: wrap;
        margin-bottom: 18px !important;
    }

    .settings-header > .mud-spacer {
        display: none;
    }

    .settings-title,
    .settings-header-action {
        flex: 1 1 100%;
        width: 100%;
    }

    .settings-title-text {
        font-size: clamp(1.45rem, 7.5vw, 1.85rem) !important;
        line-height: 1.12 !important;
    }

    .settings-title .mud-typography-body2 {
        max-width: 32rem;
        margin-top: 4px;
        line-height: 1.35;
    }

    .settings-page .mud-paper.pa-6,
    .settings-page .mud-paper.pa-4 {
        padding: 16px !important;
    }

    .settings-page .mud-grid {
        margin: 0 !important;
        width: 100% !important;
    }

    .settings-page img[alt="Logo firme"] {
        max-width: 100% !important;
    }

    .settings-page label.mud-button-root,
    .settings-page button.mud-button-root {
        width: 100%;
    }

    .settings-danger-row .mud-stack-row {
        align-items: flex-start !important;
        flex-wrap: wrap;
    }

    .settings-danger-row .mud-spacer {
        display: none;
    }

    .settings-danger-copy {
        flex: 1 1 calc(100% - 48px);
    }

    .operations-grid { grid-template-columns: 1fr; }
    .report-filter-bar .mud-stack-row:not(.reports-filter-stack) { flex-wrap: wrap; }
}

.mud-overlay-dialog,
.seam-dialog-backdrop {
    background-color: rgba(15, 23, 42, 0.48) !important;
    backdrop-filter: blur(7px) !important;
    -webkit-backdrop-filter: blur(7px) !important;
}

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

html.seam-dark .login-shell {
    background:
        radial-gradient(circle at 18% 12%, rgba(96, 165, 250, 0.18), transparent 28%),
        radial-gradient(circle at 80% 78%, rgba(45, 212, 191, 0.14), transparent 30%),
        linear-gradient(135deg, #080d18 0%, #0f172a 54%, #111827 100%);
}

.login-card-simple {
    width: min(100%, 440px);
}

.login-simple-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

@media (max-width: 640px) {
    .login-shell {
        padding: 18px;
    }

    .login-card {
        padding: 24px;
        border-radius: 16px !important;
    }
}
