:root {
    --primary-color: #ef3124;
    --primary-dark: #dc2626;
    --primary-rgb: 239, 49, 36;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --border-strong: #cbd5e1;
    --shadow: none;
    --text-main: #111827;
    --text-muted: #64748b;
    --surface-muted: #f8fafc;
    --surface-accent: #f8fafc;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #9a4d14;
    --info: #2563eb;
    --shadow-soft: none;
    --shadow-lift: none;
    --radius: 6px;
    --app-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
    --app-monospace-family: "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    height: 100%;
}

html {
    overflow-y: scroll;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 12% -10%, rgba(var(--primary-rgb), 0.10), transparent 26rem),
        radial-gradient(circle at 85% 0%, rgba(111, 83, 63, 0.08), transparent 28rem),
        linear-gradient(180deg, #f5f0ea 0%, var(--background-color) 34%, #eee8e1 100%);
    color: var(--text-main);
    font-family: var(--app-font-family);
    font-synthesis-weight: none;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

:focus-visible {
    outline: 3px solid rgba(var(--primary-rgb), 0.28);
    outline-offset: 3px;
}

.app-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 2rem 3.25rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.85rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(193, 174, 155, 0.74);
    border-radius: 12px;
    background:
        radial-gradient(120% 180% at 0% 0%, rgba(208, 54, 19, 0.12), transparent 56%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(250, 246, 241, 0.74));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.app-kicker {
    margin: 0 0 0.2rem;
    color: var(--primary-dark);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.app-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    padding: 0.38rem 0.65rem;
    border-radius: var(--radius);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.8);
}

.app-header h1 {
    margin: 0;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
}

.main-nav {
    display: block;
    padding: 0.76rem 0.9rem 0.72rem;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(193, 174, 155, 0.64);
    border-radius: 12px;
    margin-bottom: 1.35rem;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.main-nav-primary {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(193, 174, 155, 0.7);
    overflow-x: auto;
    overflow-y: hidden;
}

.main-nav-link,
.main-subnav-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.main-subnav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 1rem;
    padding-top: 0.72rem;
    overflow-x: auto;
    overflow-y: hidden;
}

.main-nav-link {
    padding: 0.18rem 0 0.3rem;
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-muted);
    position: relative;
    transition: color 0.15s ease;
}

.main-subnav-link {
    padding: 0.16rem 0 0.28rem;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--text-muted);
    position: relative;
    transition: color 0.15s ease;
}

button.main-subnav-link {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.main-nav-link::after,
.main-subnav-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.15s ease;
}

.main-nav-link:hover,
.main-subnav-link:hover {
    color: var(--text-main);
}

.main-nav-link.active,
.main-subnav-link.active {
    color: var(--text-main);
}

.main-nav-link:hover::after,
.main-nav-link.active::after,
.main-subnav-link:hover::after,
.main-subnav-link.active::after {
    transform: scaleX(1);
}

.page-content {
    display: block;
}

.page-content > section {
    display: grid;
    gap: 1.15rem;
    animation: pageEnter 0.28s ease-out both;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

.section-stack {
    display: grid;
    gap: 1.25rem;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0 0 1rem;
}

.section-header.tight,
.card-header.tight {
    margin-bottom: 0.8rem;
}

.section-kicker {
    margin: 0;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.section-header p {
    margin: 0;
    color: var(--text-muted);
}

.page-title {
    margin: 0;
    font-size: clamp(1.75rem, 2.7vw, 2.45rem);
    letter-spacing: -0.03em;
    line-height: 1.06;
}

.page-description {
    margin: -0.7rem 0 0.5rem;
    color: var(--text-muted);
    max-width: 56rem;
    font-size: 1.02rem;
    line-height: 1.62;
}

.page-content > section:not(.documents-workspace) > .page-title:first-child {
    padding: 1.4rem 1.5rem 0;
    border: 1px solid rgba(193, 174, 155, 0.74);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    background:
        radial-gradient(110% 170% at 0% 0%, rgba(var(--primary-rgb), 0.12), transparent 56%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(250, 246, 241, 0.82));
    box-shadow: var(--shadow-soft);
}

.page-content > section:not(.documents-workspace) > .page-title:first-child + .page-description {
    max-width: none;
    margin: -1.15rem 0 0.2rem;
    padding: 0.2rem 1.5rem 1.35rem;
    border: 1px solid rgba(193, 174, 155, 0.74);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(250, 246, 241, 0.82));
    box-shadow: var(--shadow-soft);
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

    .page-toolbar .button-cell {
        justify-content: flex-start;
    }

    .client-registry-filters {
        grid-template-columns: 1fr;
    }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.statistics-filters {
    position: sticky;
    top: 1rem;
    z-index: 5;
}

.stat-card,
.card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 252, 249, 0.94));
    border-radius: 10px;
    padding: 1.6rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(193, 174, 155, 0.72);
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.stat-card:hover,
.card:hover {
    border-color: rgba(193, 174, 155, 0.92);
    box-shadow: var(--shadow-lift);
}

.card + .card {
    margin-top: 1rem;
}

.card-muted {
    background:
        linear-gradient(180deg, rgba(250, 246, 241, 0.94), rgba(255, 255, 255, 0.86));
    border-style: dashed;
}

.card-accent {
    background:
        radial-gradient(120% 180% at 0% 0%, rgba(var(--primary-rgb), 0.09), transparent 58%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(250, 246, 241, 0.88));
}

.card-intro {
    padding: 1.2rem 1.35rem;
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(193, 174, 155, 0.55);
}

.card-header h3,
.card-header h4,
.card-header p {
    margin: 0;
}

.card-header h3 {
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.card-header p {
    color: var(--text-muted);
}

.card-header-split {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.card-header-split > :first-child {
    min-width: 0;
}

.card-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.stat-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-card {
    border-top: 3px solid rgba(var(--primary-rgb), 0.35);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: auto 1rem 0 1rem;
    height: 3px;
    background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.55), rgba(var(--primary-rgb), 0));
    opacity: 0.52;
}

.stat-value {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-meta {
    display: block;
    margin-top: 0.4rem;
    color: var(--text-muted);
}

.note-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-muted);
}

.note-list li {
    margin-bottom: 0.3rem;
}

.code-span {
    font-family: var(--app-monospace-family);
    background: rgba(15, 23, 42, 0.05);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card > .filters-grid:first-child,
.card > form.filters-grid:first-child,
.page-content > section > form.filters-grid {
    padding: 1rem;
    border: 1px solid rgba(193, 174, 155, 0.66);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 241, 234, 0.78));
}

.form-section + .form-section {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(193, 174, 155, 0.5);
}

.form-section-title {
    margin: 0 0 0.75rem;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dark);
}

.filters-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filters-grid label > span,
.filters-grid .field-group > span,
.filters-grid .module-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6f5546;
}

.filters-grid .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.unpaid-filters select {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
    transition: border 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.unpaid-filters input[type="text"] {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
}

.unpaid-filters input[type="password"],
.unpaid-filters input[type="number"] {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
}

.unpaid-filters textarea {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
    resize: vertical;
    min-height: 6.5rem;
}

.filters-grid input[type="text"] {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.filters-grid input[type="password"],
.filters-grid input[type="number"] {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.filters-grid textarea {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.86);
    transition: border 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
    min-height: 6.5rem;
}

.filters-grid input[type="text"]:focus {
    outline: none;
    border-color: rgba(var(--primary-rgb), 0.55);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.filters-grid input[type="password"]:focus,
.filters-grid input[type="number"]:focus {
    outline: none;
    border-color: rgba(var(--primary-rgb), 0.55);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.filters-grid textarea:focus {
    outline: none;
    border-color: rgba(var(--primary-rgb), 0.55);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.unpaid-filters select:focus,
.unpaid-filters input[type="text"]:focus,
.unpaid-filters input[type="password"]:focus,
.unpaid-filters input[type="number"]:focus,
.unpaid-filters textarea:focus {
    outline: none;
    border-color: rgba(var(--primary-rgb), 0.58);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.button-cell {
    display: flex;
    align-items: flex-end;
    justify-content: stretch;
}

.lookup-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.xml-editor {
    width: 100%;
    font-family: var(--app-monospace-family);
    font-size: 0.9rem;
    line-height: 1.45;
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    background: #fff;
    resize: vertical;
}

.checkbox-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.35rem 0;
}

.checkbox-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--primary-dark);
    border-radius: 9px;
    background: linear-gradient(180deg, #df431d, var(--primary-color));
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 10px 22px rgba(var(--primary-rgb), 0.18);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 14px 28px rgba(var(--primary-rgb), 0.22);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: translateY(0);
}

.loading-card,
.loading-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
}

.loading-card {
    flex-direction: column;
    min-height: 200px;
}

.loading-inline {
    padding: 1rem 0;
}

.tab-bar {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(193, 174, 155, 0.72);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}

.workspace-tab-bar {
    margin-top: 0;
    margin-bottom: 1.1rem;
}

.workspace-tab-bar + .tab-panel {
    margin-top: 0.25rem;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.settings-sidebar {
    display: grid;
    gap: 1rem;
    align-self: start;
    position: sticky;
    top: 1rem;
}

.settings-sidebar-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(250, 243, 238, 0.9));
}

.settings-tab-groups {
    display: grid;
    gap: 1rem;
}

.settings-tab-group {
    padding: 1rem 1rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.65);
}

.settings-tab-group-title {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.settings-tab-group .tab-bar {
    margin-top: 0.6rem;
    width: 100%;
    box-shadow: none;
    background: rgba(247, 249, 252, 0.9);
}

.settings-tab-bar {
    display: grid;
    grid-template-columns: 1fr;
}

.settings-content {
    min-width: 0;
}

.tab-button {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.settings-tab-bar .tab-button {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.tab-button:hover {
    background: rgba(var(--primary-rgb), 0.09);
    color: var(--primary-dark);
}

.tab-button.active {
    background: linear-gradient(180deg, #df431d, var(--primary-color));
    color: #fff;
    border-color: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(var(--primary-rgb), 0.16);
}

.tab-panel {
    margin-top: 0;
}

.dashboard-grid-secondary {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 1rem;
}

.dashboard-stack {
    gap: 1.5rem;
}

.dashboard-section {
    display: grid;
    gap: 1rem;
}

.dashboard-section-horizon {
    padding: 1.2rem;
    border: 1px solid rgba(193, 174, 155, 0.72);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 242, 236, 0.9));
}

.dashboard-section-operations {
    padding: 1.2rem;
    border: 1px solid rgba(193, 174, 155, 0.72);
    background: linear-gradient(180deg, rgba(246, 241, 236, 0.86), rgba(255, 255, 255, 0.94));
}

.dashboard-hero-card {
    margin: 0;
    background:
        radial-gradient(120% 180% at 0% 0%, rgba(var(--primary-rgb), 0.08), transparent 58%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(250, 246, 241, 0.88));
}

.dashboard-hero-card-operations {
    background:
        radial-gradient(120% 180% at 0% 0%, rgba(111, 83, 63, 0.08), transparent 58%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(246, 241, 236, 0.92));
}

.dashboard-grid-primary {
    margin-bottom: 0;
}

.dashboard-note-card {
    background: rgba(255, 255, 255, 0.86);
}

.dashboard-alerts-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 244, 239, 0.9));
}

.status-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.status-pill::before {
    content: '';
    width: 0.44rem;
    height: 0.44rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.55;
}

.status-pill.is-danger {
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.06);
}

.status-pill.is-success {
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.25);
    background: rgba(22, 163, 74, 0.06);
}

.status-pill.is-warning {
    color: var(--warning);
    border-color: rgba(154, 77, 20, 0.22);
    background: rgba(154, 77, 20, 0.08);
}

.status-pill.is-info {
    color: var(--info);
    border-color: rgba(37, 99, 235, 0.22);
    background: rgba(37, 99, 235, 0.06);
}

.status-pill.is-neutral {
    color: #5f5149;
    border-color: rgba(95, 81, 73, 0.18);
    background: rgba(95, 81, 73, 0.06);
}

.doc-type-chip,
.amount-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.doc-type-chip {
    padding: 0.3rem 0.58rem;
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--primary-dark);
}

.doc-type-chip.is-waybill {
    border-color: rgba(37, 99, 235, 0.2);
    background: rgba(37, 99, 235, 0.06);
    color: #1d4ed8;
}

.amount-pill {
    padding: 0.25rem 0.55rem;
    border: 1px solid rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.07);
    color: var(--success);
}

.amount-pill.is-due {
    border-color: rgba(220, 38, 38, 0.24);
    background: rgba(220, 38, 38, 0.07);
    color: var(--danger);
}

.amount-pill.is-muted {
    border-color: rgba(113, 95, 86, 0.18);
    background: rgba(113, 95, 86, 0.06);
    color: var(--text-muted);
}

.vendor-page-grid {
    display: grid;
    gap: 1.25rem;
}

.workspace-form {
    display: grid;
    gap: 1rem;
}

.workspace-form-main {
    margin-bottom: 0;
}

.workspace-advanced {
    border: 1px solid rgba(193, 174, 155, 0.65);
    background: rgba(255, 255, 255, 0.7);
    padding: 0.85rem 0.95rem 0.95rem;
}

.workspace-advanced summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
}

.workspace-advanced[open] summary {
    margin-bottom: 0.85rem;
}

.workspace-advanced-grid {
    margin-bottom: 0;
}

.workspace-select-field span {
    color: var(--text-main);
}

.workspace-select-field select {
    background: #fff;
    border-color: rgba(var(--primary-rgb), 0.22);
}

.workspace-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.workspace-confirm-inline {
    gap: 0.55rem;
    padding: 0.2rem 0;
    font-weight: 600;
    color: var(--text-main);
}

.workspace-confirm-inline input[type="checkbox"] {
    margin-top: 0;
}

.workspace-confirm-inline span {
    display: block;
    line-height: 1.35;
}

.table-note {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.4;
}

.inline-alert-space {
    margin-top: 0.75rem;
}

.stack-gap-sm {
    display: grid;
    gap: 0.35rem;
}

.module-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.table-space-bottom {
    margin-bottom: 1rem;
}

.toolbar-tight {
    margin-bottom: 0.75rem;
}

.auth-admin-card {
    display: grid;
    gap: 1.1rem;
}

.auth-admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.auth-admin-header h3,
.auth-admin-header p {
    margin: 0;
}

.auth-users-table {
    margin-bottom: 0;
}

.auth-users-table input {
    width: 100%;
}

.auth-settings-section {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
}

.auth-password-panel summary {
    cursor: pointer;
    color: var(--primary-dark);
    font-size: 0.86rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-password-panel[open] summary {
    margin-bottom: 0.85rem;
}

.auth-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.auth-module-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.auth-add-user-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 0.8rem;
    align-items: end;
}

.auth-add-user-form label,
.auth-password-form label {
    display: grid;
    gap: 0.35rem;
}

.auth-add-user-form input,
.auth-add-user-form button,
.auth-password-form input,
.auth-password-form select,
.auth-password-form button {
    width: 100%;
}

.auth-add-modules-field {
    grid-column: 1 / -1;
}

.auth-add-user-form .button-cell {
    grid-column: 1 / -1;
    justify-self: end;
}

.auth-password-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    gap: 0.8rem;
    align-items: end;
}

.auth-module-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    align-items: center;
    min-height: 74px;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.auth-module-card:hover {
    border-color: rgba(220, 47, 22, 0.35);
    background: #fffafa;
}

.auth-module-card-copy {
    display: grid;
    gap: 0.25rem;
}

.auth-module-card-copy strong {
    color: var(--text-main);
    font-size: 0.9rem;
}

.auth-module-card-copy small {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.auth-module-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-module-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #d1d5db;
    transition: background 0.16s ease;
}

.auth-module-toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
    transition: transform 0.16s ease;
}

.auth-module-card input:checked + .auth-module-toggle {
    background: var(--primary-color);
}

.auth-module-card input:checked + .auth-module-toggle::after {
    transform: translateX(18px);
}

.auth-module-grid.compact .auth-module-card {
    min-height: 42px;
    padding: 0.55rem 0.6rem;
    gap: 0.55rem;
}

.auth-module-grid.compact .auth-module-card-copy strong {
    font-size: 0.78rem;
}

.auth-module-grid.compact .auth-module-card-copy small {
    display: none;
}

.auth-module-grid.compact .auth-module-toggle {
    width: 34px;
    height: 20px;
}

.auth-module-grid.compact .auth-module-toggle::after {
    width: 14px;
    height: 14px;
}

.auth-module-grid.compact .auth-module-card input:checked + .auth-module-toggle::after {
    transform: translateX(14px);
}

#auth-change-modules-form {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) auto;
    align-items: end;
}

#auth-change-modules-form .auth-modules-field {
    grid-column: 1 / -1;
}

#auth-change-modules-form .button-cell {
    justify-self: end;
}

#auth-edit-modules.auth-module-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.auth-settings-section + .auth-settings-section {
    margin-top: 0;
}

.action-col {
    width: 1%;
    white-space: nowrap;
}

.compact-table table {
    min-width: 0;
}

@media (max-width: 960px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        position: static;
    }

    .settings-tab-bar {
        grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
    }

    .settings-tab-bar .tab-button {
        width: auto;
        text-align: center;
    }

    .settings-content {
        display: grid;
        gap: 1rem;
    }

    .card-header-split {
        flex-direction: column;
        align-items: flex-start;
    }

    .workspace-summary-bar {
        align-items: flex-start;
    }
}

.compact-table th,
.compact-table td {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.subtle-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 0.5rem 0;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(15, 23, 42, 0.08);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 1s !important;
        animation-iteration-count: infinite !important;
    }
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(193, 174, 155, 0.78);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.data-table-shell {
    border-color: rgba(193, 174, 155, 0.78);
    box-shadow: var(--shadow-soft);
}

.data-table-shell table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table-shell th,
.data-table-shell td {
    vertical-align: middle;
}

.data-table-shell tbody tr {
    transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.data-table-shell tbody tr:nth-child(even) {
    background: rgba(250, 246, 241, 0.58);
}

.data-table-shell tbody tr:hover {
    background: rgba(247, 237, 227, 0.96);
}

.data-table-shell .clickable-row:hover {
    box-shadow: inset 3px 0 0 rgba(var(--primary-rgb), 0.45);
}

.document-lines-row td {
    padding: 1rem 1rem 1.1rem;
    background: linear-gradient(180deg, rgba(249, 245, 240, 0.96), rgba(245, 240, 234, 0.92));
}

.document-raw-row td {
    padding: 0.9rem 0.9rem 1rem;
    background: rgba(248, 250, 252, 0.9);
}

.document-lines-panel {
    border: 1px solid rgba(193, 174, 155, 0.78);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 248, 244, 0.94));
    padding: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.document-lines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(193, 174, 155, 0.45);
}

.document-lines-header strong {
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.document-lines-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.document-lines-summary-item {
    display: grid;
    gap: 0.15rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(193, 174, 155, 0.68);
    background: rgba(255, 255, 255, 0.84);
}

.document-lines-summary-item span {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.document-lines-summary-item strong {
    font-size: 0.98rem;
    line-height: 1.3;
}

.nested-table {
    min-width: 0;
}

.nested-table table {
    min-width: 0;
}

.nested-table th,
.nested-table td {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.nested-table thead th {
    background: rgba(247, 239, 232, 0.96);
}

.nested-table tbody tr:nth-child(even) {
    background: rgba(250, 246, 241, 0.72);
}

.nested-table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.06);
}

.client-detail-row td {
    padding: 0.9rem 0.9rem 1rem;
    background: rgba(248, 250, 252, 0.9);
}

.client-detail-panel {
    border: 1px solid var(--border-color);
    background: #fff;
    padding: 0.9rem;
}

.client-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th, td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid rgba(217, 205, 192, 0.75);
    text-align: left;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(180deg, #f8f0e9, #f1e5dc);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: rgba(250, 243, 238, 0.92);
}

.table-container tbody tr {
    transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.table-container tbody tr:nth-child(even) {
    background: rgba(250, 246, 241, 0.52);
}

.table-container .clickable-row:hover {
    box-shadow: inset 3px 0 0 rgba(var(--primary-rgb), 0.44);
}

.clickable-row {
    cursor: pointer;
}

.text-center {
    text-align: center;
}

.text-green {
    color: var(--success);
}

.text-red {
    color: var(--danger);
}

.stats-layout {
    display: grid;
    gap: 2rem;
}

.chart-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    align-items: start;
}

.table-stack {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1fr);
}

.unpaid-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: stretch;
}

.summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-pair {
    display: grid;
    gap: 0.75rem;
}

.metric-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-sub {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.summary-inline {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(193, 174, 155, 0.68);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-soft);
}

.loading-inline {
    padding: 1rem 1.1rem;
    border: 1px dashed rgba(193, 174, 155, 0.7);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.7);
}

.operation-loading,
.vendor-operation-loading {
    justify-content: flex-start;
    gap: 0.9rem;
    min-height: 84px;
    padding: 1rem 1.15rem;
    border-style: solid;
    border-color: var(--border);
    background: #fff;
}

.operation-loading-copy,
.vendor-loading-copy {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.operation-loading-copy strong,
.vendor-loading-copy strong {
    color: var(--text);
    font-size: 0.95rem;
}

.operation-loading-copy p,
.vendor-loading-copy p {
    margin: 0;
    color: var(--text-muted);
}

.loading-activity-meta,
.vendor-loading-meta {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.loading-inline-prominent {
    justify-content: flex-start;
    padding: 1.15rem 1.25rem;
    border-style: solid;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.05), rgba(255, 255, 255, 0.9));
}

.loading-inline-prominent p {
    margin: 0;
}

.empty-state-inline,
.empty-state-card {
    color: var(--text-muted);
}

.empty-state-inline {
    display: block;
    padding: 0.95rem 1rem;
    border: 1px dashed rgba(193, 174, 155, 0.75);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.74);
    list-style: none;
}

.empty-state-card {
    padding: 1rem 1.05rem;
    border: 1px dashed rgba(193, 174, 155, 0.75);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.74);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin: 1.5rem 0 1rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 9px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 700;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-secondary:hover {
    background: #fff;
    border-color: rgba(var(--primary-rgb), 0.32);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.btn-secondary.btn-small,
.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
}

.row-actions {
    display: inline-flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.stat-block {
    display: grid;
    gap: 1rem;
}

.stat-block-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-block-header h3 {
    margin: 0;
    font-size: 1.4rem;
}

.stat-block-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.chart-card h4,
.table-card h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.chart-canvas {
    position: relative;
    width: 100%;
    height: 320px;
}

.chart-canvas canvas,
.chart-canvas > div {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.debug-card details {
    cursor: pointer;
}

.raw-response-details > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
}

.raw-response-details[open] > summary {
    margin-bottom: 0.6rem;
}

.debug-content {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1200;
}

.modal-card {
    width: min(560px, 100%);
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 1rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}

.modal-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.tech-service-orgs {
    display: grid;
    gap: 0.18rem;
    min-width: 12rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.tech-service-orgs strong {
    color: var(--text-main);
    font-weight: 600;
}

.tech-client-sync {
    margin-top: 0.55rem;
    white-space: nowrap;
}

.tech-provider-health-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.tech-provider-health-card {
    min-height: 0;
}

.tech-provider-health-card .status-pill {
    margin-top: 0.25rem;
}

.tech-provider-health-card.has-attention {
    border-color: #fca5a5;
}

.tech-provider-health-card.has-warning {
    border-color: #fcd34d;
}

.tech-history-change {
    max-width: 24rem;
    overflow-wrap: anywhere;
}

.tech-conclusion-cell {
    min-width: 15rem;
}

.tech-anomaly-list {
    margin: 0.45rem 0;
    padding-left: 1.1rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.tech-exception-note {
    margin: 0.45rem 0;
    color: var(--text-main);
    font-size: 0.8rem;
}

.tech-exception-modal-card {
    width: min(620px, 96vw);
}

.tech-exception-modal-card textarea {
    width: 100%;
    resize: vertical;
}

.halopsa-ticket-modal-card {
    width: min(680px, 96vw);
}

.halopsa-ticket-modal-card textarea {
    width: 100%;
    resize: vertical;
}

.vendor-nom-modal-card {
    width: min(1040px, 96vw);
    max-height: min(88vh, 980px);
    overflow: auto;
    padding: 1.35rem;
}

.vendor-nom-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(193, 174, 155, 0.65);
}

.vendor-nom-modal-heading h3,
.vendor-nom-modal-heading p {
    margin: 0;
}

.vendor-nom-modal-heading p {
    color: var(--text-muted);
}

.vendor-nom-modal-heading .section-kicker {
    margin-bottom: 0.3rem;
}

.vendor-nom-context {
    margin-bottom: 1rem;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(193, 174, 155, 0.75);
    background: linear-gradient(135deg, rgba(208, 54, 19, 0.06), rgba(255, 255, 255, 0.95));
}

.vendor-nom-context-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.vendor-nom-context-item {
    display: grid;
    gap: 0.15rem;
}

.vendor-nom-context-item span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vendor-nom-context-item strong {
    font-size: 0.98rem;
    line-height: 1.35;
}

.vendor-nom-context-description {
    margin: 0.85rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(193, 174, 155, 0.65);
    color: var(--text-main);
}

.vendor-nom-form {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.vendor-nom-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(193, 174, 155, 0.75);
    background: #fff;
}

.vendor-nom-panel-muted {
    background: var(--surface-muted);
}

.vendor-nom-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}

.vendor-nom-panel-header h4,
.vendor-nom-panel-header p {
    margin: 0;
}

.vendor-nom-panel-header h4 {
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.vendor-nom-panel-header p {
    margin-top: 0.2rem;
    color: var(--text-muted);
}

.vendor-nom-name-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.vendor-nom-group-selected {
    min-width: 13rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(193, 174, 155, 0.8);
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.45;
}

.vendor-nom-group-selected strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dark);
}

.vendor-nom-group-field {
    gap: 0.65rem;
}

.nom-group-tree {
    min-height: 11rem;
    max-height: min(38vh, 380px);
    overflow: auto;
    border: 1px solid rgba(193, 174, 155, 0.82);
    background: rgba(255, 255, 255, 0.96);
    padding: 0.45rem;
}

.nom-group-tree-status {
    margin: 0.45rem 0.55rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.nom-group-tree-row {
    display: flex;
    align-items: stretch;
    gap: 0.15rem;
    padding-left: calc(0.35rem + (var(--nom-tree-depth, 0) * 1rem));
}

.nom-group-tree-toggle,
.nom-group-tree-toggle-spacer {
    width: 1.7rem;
    min-width: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.nom-group-tree-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 0.92rem;
}

.nom-group-tree-toggle:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--text-main);
}

.nom-group-tree-node {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0.45rem 0.6rem;
    margin: 0.08rem 0;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.94rem;
    line-height: 1.35;
}

.nom-group-tree-node:hover {
    background: rgba(var(--primary-rgb), 0.08);
}

.nom-group-tree-node.selected {
    background: rgba(var(--primary-rgb), 0.14);
    font-weight: 700;
}

.nom-group-tree-node .meta {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.86rem;
}

.vendor-nom-modal-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(193, 174, 155, 0.65);
}

.vendor-nom-modal-footer-copy {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.vendor-nom-modal-footer-copy .metric-sub {
    margin: 0;
}

.vendor-nom-save-hint {
    margin: 0;
    color: var(--text-muted);
    min-height: 1.5em;
}

.vendor-nom-save-hint.is-warning {
    color: var(--warning);
}

.vendor-nom-save-hint.is-success {
    color: var(--success);
}

@media (max-width: 900px) {
    .vendor-nom-form {
        grid-template-columns: 1fr;
    }

    .vendor-nom-panel-header,
    .vendor-nom-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .vendor-nom-group-selected {
        min-width: 0;
    }
}

.advance-expenses-page,
.advance-expenses-card { display: grid; gap: 18px; }
.advance-expenses-filters { align-items: end; }
.advance-expenses-table td { vertical-align: middle; }
.advance-expenses-table select { min-width: 150px; }
.advance-expenses-select-cell { width: 42px; text-align: center; }
.advance-expenses-bulk-actions { margin-left: auto; }

.horizon-client-management-page,
.horizon-client-management-page #horizon-client-results {
    display: grid;
    gap: 1rem;
}

.horizon-client-filters {
    grid-template-columns: minmax(170px, 0.7fr) minmax(240px, 1fr) minmax(260px, 1.3fr) auto;
}

.horizon-client-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1.25rem;
    color: var(--text-muted);
}

.horizon-client-summary strong {
    color: var(--text-main);
}

.horizon-client-bulk-card {
    display: grid;
    gap: 1rem;
}

.horizon-client-bulk-form {
    display: grid;
    grid-template-columns: minmax(260px, 0.7fr) minmax(360px, 1.3fr);
    gap: 1rem;
    align-items: end;
}

.horizon-client-apply-field {
    display: grid;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.horizon-client-input-action {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.horizon-client-input-action input,
.horizon-client-input-action select {
    min-width: 0;
    flex: 1;
}

.horizon-client-save-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.horizon-client-table-wrap {
    max-height: 68vh;
}

.horizon-client-table {
    min-width: 940px;
}

.horizon-client-table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.horizon-client-table td {
    vertical-align: middle;
}

.horizon-client-select-cell {
    width: 44px;
    text-align: center;
}

.horizon-client-term-input {
    width: 9rem;
}

.horizon-client-method-input {
    min-width: 14rem;
}

.horizon-client-term-input.is-missing,
.horizon-client-method-input.is-missing {
    border-color: #d97706;
    background: #fffbeb;
}

.horizon-client-change-status {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.horizon-client-change-status.is-changed {
    color: #9a3412;
    font-weight: 800;
}

@media (max-width: 980px) {
    .horizon-client-filters,
    .horizon-client-bulk-form {
        grid-template-columns: 1fr;
    }

    .horizon-client-save-actions {
        grid-column: auto;
        justify-content: flex-start;
    }
}
.advance-expense-duplicate-row td {
    background: #fff7ed;
}
.advance-expense-duplicate-row td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}
.advance-duplicate-cell {
    display: grid;
    gap: 6px;
    min-width: 260px;
    max-width: 360px;
}
.advance-duplicate-cell .btn-small {
    justify-self: start;
}
.advance-duplicate-matches {
    display: grid;
    gap: 5px;
}
.advance-duplicate-match {
    display: grid;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    background: #fffaf5;
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.3;
}
.advance-duplicate-match strong {
    color: #111827;
    font-size: 0.82rem;
}
.advance-client-picker { position: relative; min-width: 240px; }
.advance-client-picker > input[type="search"] { width: 100%; }
.advance-client-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-color, #dfe3ea);
    background: #fff;
}
.advance-client-suggestion {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid var(--border-color, #dfe3ea);
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.advance-client-suggestion:hover { background: #f8fafc; }
.advance-client-suggestion span { color: var(--text-muted); font-size: 0.8rem; }
.advance-client-suggestion-empty { padding: 10px; color: var(--text-muted); }
.advance-preview-file-list { display: grid; gap: 10px; padding: 18px; }

.debug-content pre {
    background: rgba(15, 23, 42, 0.06);
    padding: 1rem;
    border-radius: var(--radius);
    max-height: 260px;
    overflow: auto;
}

.debug-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.comparison-table {
    min-width: 100%;
    table-layout: fixed;
}

.comparison-table th {
    white-space: normal;
}

.comparison-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comparison-table th,
.comparison-table td {
    font-size: 0.92rem;
}

.app-footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-body {
    min-height: 100vh;
    background: #f7f9fc;
    color: #172033;
}

.auth-shell {
    min-height: 100vh;
    max-width: 640px;
    margin: 0 auto;
    padding: 7vh 1.25rem 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(100%, 520px);
    padding: 4.7rem 4.3rem 3.6rem;
    border: 1px solid #e1e7f0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 22px 56px rgba(30, 41, 59, 0.16);
}

.auth-card h1 {
    margin: 2.4rem 0 2.7rem;
    color: #24324a;
    text-align: center;
    font-size: 1.6rem;
    line-height: 1.25;
    font-weight: 700;
}

.auth-brand {
    min-height: 5.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.auth-brand-logo {
    display: block;
    max-width: min(260px, 100%);
    max-height: 86px;
    object-fit: contain;
}

.auth-wordmark {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.28rem;
    font-size: 2.55rem;
    line-height: 1;
    font-weight: 400;
}

.auth-wordmark span:first-child {
    color: #f5a033;
}

.auth-wordmark span:last-child {
    color: #e0211b;
}

.auth-brand p {
    margin: 0.35rem 0 0;
    color: #6a7280;
    font-size: 1.05rem;
    line-height: 1.2;
}

.auth-setup-note {
    margin: -1.8rem 0 2rem;
    text-align: center;
    color: #64748b;
    font-weight: 700;
}

.auth-form {
    display: grid;
    gap: 1.35rem;
    margin-bottom: 0;
}

.auth-field {
    display: grid;
    gap: 0.65rem;
    margin: 0;
}

.auth-field > span:first-child {
    color: #526079;
    font-size: 0.9rem;
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-input-wrap {
    min-height: 58px;
    display: grid;
    grid-template-columns: 3.25rem 1fr;
    align-items: center;
    border: 1px solid #d5dde8;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-input-wrap:focus-within {
    border-color: #93a4bb;
    box-shadow: 0 0 0 3px rgba(56, 130, 246, 0.12);
}

.auth-input-icon {
    color: #53637d;
    text-align: center;
    font-size: 1.55rem;
    font-weight: 700;
}

.auth-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 56px;
    padding: 0 1rem 0 0;
    border: 0 !important;
    outline: 0 !important;
    background: transparent;
    color: #172033;
    font-size: 1.03rem;
    box-shadow: none !important;
    appearance: none;
}

.auth-input-wrap input::placeholder {
    color: #8a95a8;
}

.auth-submit,
.auth-microsoft-button {
    width: 100%;
    min-height: 58px;
    border-radius: 8px;
    font-size: 1.04rem;
    line-height: 1.2;
    font-weight: 800;
}

.auth-submit {
    margin-top: 0.45rem;
    border: 1px solid #e21b14;
    background: #ef1711;
    color: #fff;
    box-shadow: 0 12px 26px rgba(239, 23, 17, 0.18);
    cursor: pointer;
}

.auth-submit:hover {
    background: #dc1510;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.25rem;
    align-items: center;
    margin: 1.75rem 0 1.25rem;
    color: #7a8597;
    font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    background: #dfe5ed;
}

.auth-microsoft-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.72rem;
    border: 1px solid #d8e0ea;
    background: #fff;
    color: #2c374b;
    cursor: pointer;
    text-decoration: none;
}

.auth-microsoft-button:hover {
    border-color: #b8c4d4;
    background: #f8fafc;
}

.microsoft-mark {
    width: 22px;
    height: 22px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
}

.microsoft-mark i:nth-child(1) { background: #f25022; }
.microsoft-mark i:nth-child(2) { background: #7fba00; }
.microsoft-mark i:nth-child(3) { background: #00a4ef; }
.microsoft-mark i:nth-child(4) { background: #ffb900; }

.plain-details {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.plain-details summary {
    cursor: pointer;
    color: var(--text-main);
    font-weight: 800;
}

.raw-json-input,
.debug-json {
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f8fafc;
    color: #172033;
    font-family: var(--app-monospace-family);
    font-size: 0.9rem;
    line-height: 1.45;
}

.debug-json {
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
}

.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 9px;
    margin-bottom: 1rem;
    font-weight: 600;
    border: 1px solid rgba(193, 174, 155, 0.72);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow-soft);
}

.alert-error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.alert-success {
    background: rgba(22, 163, 74, 0.08);
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.2);
}

.alert-warning {
    background: rgba(154, 77, 20, 0.09);
    color: var(--warning);
    border-color: rgba(154, 77, 20, 0.22);
}

.alert-info {
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--primary-dark);
    border-color: rgba(var(--primary-rgb), 0.18);
}

.ops-alert-list {
    display: grid;
    gap: 0.8rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ops-alert-item {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(193, 174, 155, 0.7);
    background: rgba(255, 255, 255, 0.78);
}

.ops-alert-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.ops-alert-item-header strong {
    font-size: 1rem;
}

.ops-alert-item-meta,
.ops-alert-item-copy {
    margin: 0;
}

.ops-alert-item-meta {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.ops-alert-item-copy {
    margin-top: 0.45rem;
    line-height: 1.45;
}

.tracking-dashboard-stack {
    gap: 1.5rem;
}

.tracking-dashboard-shell {
    display: grid;
    gap: 1.15rem;
    padding: 1.2rem;
    border: 1px solid rgba(193, 174, 155, 0.72);
    background:
        linear-gradient(180deg, rgba(249, 244, 239, 0.92), rgba(255, 255, 255, 0.96)),
        linear-gradient(90deg, rgba(var(--primary-rgb), 0.03), rgba(0, 0, 0, 0));
}

.tracking-dashboard-hero {
    background:
        linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(255, 255, 255, 0.96) 34%, rgba(247, 240, 235, 0.94));
}

.tracking-dashboard-sync-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(193, 174, 155, 0.55);
}

.tracking-sync-label {
    display: block;
    margin-bottom: 0.15rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tracking-summary-grid,
.tracking-window-grid,
.tracking-detail-grid {
    display: grid;
    gap: 1rem;
}

.tracking-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tracking-window-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.tracking-detail-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
}

.tracking-stat-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 244, 239, 0.88));
}

.tracking-stat-card-alert {
    border-top-color: rgba(220, 38, 38, 0.45);
}

.tracking-window-card,
.tracking-detail-card {
    background: rgba(255, 255, 255, 0.9);
}

.tracking-window-card-transit {
    border-top: 3px solid rgba(var(--primary-rgb), 0.48);
}

.tracking-window-card-out {
    border-top: 3px solid rgba(111, 83, 63, 0.45);
}

.tracking-detail-card-issues {
    background:
        linear-gradient(180deg, rgba(255, 246, 243, 0.96), rgba(255, 255, 255, 0.92));
}

.tracking-card-list {
    display: grid;
    gap: 0.8rem;
}

.tracking-card-list-compact {
    gap: 0.7rem;
}

.tracking-card {
    position: relative;
    padding: 1rem 1rem 0.95rem 1.15rem;
    border: 1px solid rgba(193, 174, 155, 0.68);
    background: rgba(255, 255, 255, 0.88);
    overflow: hidden;
}

.tracking-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: rgba(111, 83, 63, 0.25);
}

.tracking-card-delivered::before {
    background: rgba(22, 163, 74, 0.55);
}

.tracking-card-in_transit::before {
    background: rgba(154, 77, 20, 0.55);
}

.tracking-card-exception::before {
    background: rgba(220, 38, 38, 0.6);
}

.tracking-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
    margin-bottom: 0.45rem;
}

.tracking-card-kicker {
    margin: 0 0 0.2rem;
    color: var(--primary-dark);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tracking-card h4 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.tracking-card-meta,
.tracking-card-note {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.45;
}

.tracking-card-meta {
    font-size: 0.89rem;
}

.tracking-card-note {
    margin-top: 0.45rem;
    color: var(--text-color);
    font-size: 0.88rem;
}

.tracking-card-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.7rem;
}

.tracking-card-timeline {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(193, 174, 155, 0.55);
    display: grid;
    gap: 0.7rem;
}

.tracking-timeline-item {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 0.75rem;
}

.tracking-timeline-time {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.tracking-timeline-body {
    display: grid;
    gap: 0.15rem;
}

.tracking-timeline-body strong {
    font-size: 0.92rem;
}

.tracking-timeline-body span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.tracking-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.tracking-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 12, 0.45);
}

.tracking-modal-dialog {
    position: relative;
    width: min(100%, 980px);
    max-height: min(92vh, 920px);
    overflow: auto;
    background: #fffdfb;
    border: 1px solid rgba(193, 174, 155, 0.75);
    box-shadow: 0 24px 80px rgba(24, 18, 13, 0.28);
    padding: 1.15rem 1.2rem 1.2rem;
}

.tracking-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.tracking-modal-header h3,
.tracking-modal-header p {
    margin: 0;
}

.tracking-invoice-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
    padding: 0.9rem 0 1rem;
}

.tracking-invoice-lines-wrap {
    overflow-x: auto;
}

body.tracking-modal-open {
    overflow: hidden;
}

.error-card {
    border-left: 4px solid var(--danger);
}

/* INDEED MSP Portal design refresh */
:root {
    --primary-color: #ef4444;
    --primary-dark: #dc2626;
    --primary-rgb: 239, 68, 68;
    --accent-blue: #3862f6;
    --accent-green: #10b981;
    --accent-purple: #6b60f1;
    --background-color: #f9fafb;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --border-strong: #d1d5db;
    --text-main: #111827;
    --text-muted: #6b7280;
    --surface-muted: #f9fafb;
    --surface-accent: #fff1f2;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3862f6;
    --shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
    --shadow-soft: 0 2px 8px rgba(16, 24, 40, 0.04);
    --shadow-lift: 0 16px 40px rgba(16, 24, 40, 0.08);
    --radius: 8px;
}

html,
body {
    min-height: 100%;
}

body {
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 44%, #f3f4f6 100%);
    color: var(--text-main);
    font-family: var(--app-font-family);
    line-height: 1.45;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 1rem;
    border-right: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    padding: 1.45rem 1.25rem;
    z-index: 40;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 2.4rem;
}

.app-brand-logo {
    display: block;
    max-width: 9.5rem;
    max-height: 2.3rem;
    object-fit: contain;
}

.app-brand-mark {
    color: var(--primary-dark);
    font-size: 1.18rem;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.app-brand-sub {
    color: #374151;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.app-logo-preview-wrap {
    display: grid;
    gap: 0.5rem;
    align-self: end;
}

.app-logo-preview {
    display: flex;
    align-items: center;
    min-height: 3.1rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #ef1f1f;
    font-weight: 900;
    letter-spacing: 0.22em;
}

.app-logo-preview img {
    max-width: 12rem;
    max-height: 2.4rem;
    object-fit: contain;
}

.auth-user-profile-input {
    width: min(16rem, 100%);
    min-width: 10rem;
}

.report-change-list {
    display: grid;
    gap: 0.4rem;
    min-width: 18rem;
}

.report-change-item {
    display: grid;
    gap: 0.1rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f8fafc;
}

.report-change-item strong {
    color: #0f172a;
    font-size: 0.84rem;
}

.report-change-item span {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.35;
}

.report-history-muted {
    display: grid;
    gap: 0.35rem;
    min-width: 16rem;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.4;
}

.report-history-details {
    max-width: 28rem;
}

.report-history-details summary {
    cursor: pointer;
    color: #475569;
    font-weight: 700;
}

.report-history-details span {
    display: block;
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
    color: #64748b;
}

.sidebar-nav {
    overflow-y: auto;
    padding-right: 0.1rem;
}

.sidebar-group {
    display: grid;
    gap: 0.32rem;
    margin: 0 0 1.35rem;
}

.sidebar-group-label {
    margin: 0 0 0.4rem;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-link {
    min-height: 2.55rem;
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.62rem 0.72rem;
    border-radius: 8px;
    color: #374151;
    font-size: 0.92rem;
    font-weight: 650;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-link:hover {
    background: #f3f4f6;
    color: var(--text-main);
}

.sidebar-link.active {
    background: #fee2e2;
    color: var(--primary-dark);
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.sidebar-link-icon {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.68rem;
    font-weight: 800;
}

.sidebar-link.active .sidebar-link-icon {
    background: #fecaca;
    color: var(--primary-dark);
}

.sidebar-footer {
    display: grid;
    gap: 0.25rem;
    color: #9ca3af;
    font-size: 0.78rem;
}

.app-main-shell {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
}

.topbar-search {
    width: min(460px, 44vw);
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    box-shadow: var(--shadow-soft);
}

.topbar-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    color: var(--text-main);
    background: transparent;
    font: inherit;
}

.topbar-shortcut {
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-button {
    position: relative;
    width: 2.45rem;
    height: 2.45rem;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.notification-dot {
    position: absolute;
    top: 0.38rem;
    right: 0.42rem;
    width: 0.48rem;
    height: 0.48rem;
    border-radius: 999px;
    background: var(--primary-color);
    border: 2px solid #fff;
}

.topbar-user {
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--accent-blue);
    font-weight: 850;
}

.topbar-user strong,
.topbar-user small {
    display: block;
    line-height: 1.1;
}

.topbar-user strong {
    font-size: 0.86rem;
}

.topbar-user small {
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.topbar-logout {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.page-content {
    padding: 1.7rem 1rem 2rem;
}

.page-content > section {
    width: 100%;
    max-width: none;
    margin: 0;
    gap: 1.25rem;
    animation: none;
}

.page-title {
    margin: 0;
    color: #111827;
    font-size: 1.55rem;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: 0;
}

.page-description {
    max-width: 760px;
    margin: -0.75rem 0 0;
    color: var(--text-muted);
    font-size: 0.93rem;
}

.app-footer {
    padding: 0 2rem 1.25rem;
    color: #9ca3af;
    font-size: 0.78rem;
}

.card,
.stat-card,
.dashboard-hero-card,
.dashboard-note-card,
.dashboard-alerts-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    box-shadow: var(--shadow);
}

.card {
    padding: 1.1rem;
}

.card-muted {
    background: #fff;
}

.card-header h3,
.section-header h3,
.stat-card h3 {
    margin: 0;
    color: #111827;
    font-weight: 800;
    letter-spacing: 0;
}

.card-header p,
.section-header p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
}

.section-kicker {
    margin: 0;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.filters-grid,
.page-toolbar,
.unpaid-filters {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    padding: 1rem;
}

label {
    color: #4b5563;
    font-size: 0.82rem;
    font-weight: 750;
}

input,
select,
textarea {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: #111827;
    min-height: 2.55rem;
    box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(56, 98, 246, 0.7);
    outline: 3px solid rgba(56, 98, 246, 0.12);
}

.btn-primary,
.btn-secondary,
.btn-small,
button {
    border-radius: 8px;
    font-weight: 800;
    letter-spacing: 0;
}

.btn-primary {
    border: 1px solid var(--primary-dark);
    background: linear-gradient(180deg, #ff4a32 0%, #dc2f16 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(239, 68, 68, 0.22);
}

.btn-secondary,
.btn-small {
    border: 1px solid var(--border-color);
    background: #fff;
    color: #111827;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-small:hover {
    transform: translateY(-1px);
}

.cards-grid,
.dashboard-grid-primary,
.dashboard-grid-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    min-height: 7.2rem;
    padding: 1rem;
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.stat-card h3 {
    color: #4b5563;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.stat-value {
    margin: 0;
    color: #111827;
    font-size: 1.55rem;
    line-height: 1.2;
    font-weight: 850;
}

.stat-meta,
.metric-sub {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.text-red {
    color: var(--danger) !important;
}

.data-table,
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td,
table th,
table td {
    border-bottom: 1px solid var(--border-color);
    padding: 0.78rem 0.85rem;
    vertical-align: middle;
}

.data-table th,
table th {
    background: #fafafa;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background: #fcfcfd;
}

.table-responsive {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: auto;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.6rem;
    padding: 0.2rem 0.55rem;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: #f9fafb;
    color: #374151;
    font-size: 0.76rem;
    font-weight: 800;
}

.status-pill::before {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.72;
}

.status-pill.is-success,
.status-pill.success {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #047857;
}

.status-pill.is-warning,
.status-pill.warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #b45309;
}

.status-pill.is-error,
.status-pill.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
}

.status-pill.is-info,
.status-pill.info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
}

.alert,
.alert-error,
.alert-warning,
.alert-info,
.alert-success {
    border-radius: 8px;
    padding: 0.8rem 0.95rem;
    font-weight: 750;
}

.alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #dc2626;
}

.alert-warning {
    border: 1px solid #fed7aa;
    background: #fffbeb;
    color: #b45309;
}

.alert-info {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
}

.alert-success {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #047857;
}

.empty-state-inline {
    color: var(--text-muted);
}

.modal-backdrop {
    background: rgba(17, 24, 39, 0.44);
    backdrop-filter: blur(4px);
    z-index: 1600;
}

.modal-card,
.tracking-modal-dialog {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fff;
    box-shadow: 0 24px 80px rgba(17, 24, 39, 0.22);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.client-registry-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(170px, 220px) auto auto;
    gap: 0.65rem;
    align-items: end;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fafafa;
}

.client-registry-filters label {
    display: grid;
    gap: 0.28rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.client-registry-filters input,
.client-registry-filters select {
    min-height: 2.35rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    padding: 0.45rem 0.6rem;
}

.client-registry-filters .metric-sub {
    align-self: center;
    white-space: nowrap;
}

.subscription-filters {
    display: grid;
    grid-template-columns: minmax(220px, 360px) auto 1fr;
    gap: 0.65rem;
    align-items: end;
    margin: 0 0 0.85rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fafafa;
}

.subscription-filters label {
    display: grid;
    gap: 0.28rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.subscription-filters .checkbox-field {
    min-height: 2.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-main);
    white-space: nowrap;
}

.subscription-filters .checkbox-field input {
    min-height: 0;
}

.subscription-filters input[type="search"] {
    min-height: 2.35rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    padding: 0.45rem 0.6rem;
}

.subscription-filters .metric-sub {
    align-self: center;
}

.client-registry-table-wrap {
    max-height: 68vh;
    max-width: 100%;
    overscroll-behavior-x: contain;
}

.client-registry-table {
    table-layout: fixed;
    min-width: 1040px;
}

.client-registry-table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.client-registry-table td {
    padding: 0.3rem;
}

.client-registry-table td:first-child,
.client-registry-table th:first-child {
    width: 42px;
}

.client-registry-table td:nth-child(2),
.client-registry-table th:nth-child(2) {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
    width: 138px;
    min-width: 138px;
}

.client-registry-table th:nth-child(2) {
    background: #fafafa;
    z-index: 4;
}

.client-registry-input {
    width: 100%;
    min-width: 0;
    height: 2.2rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    padding: 0.38rem 0.45rem;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.86rem;
}

.client-registry-input:hover {
    border-color: var(--border-color);
    background: #fcfcfd;
}

.client-registry-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
    outline: none;
}

.client-registry-input.is-id {
    color: var(--text-muted);
    background: #f9fafb;
}

.client-registry-table th:nth-child(3),
.client-registry-table td:nth-child(3) {
    width: 180px;
}

.client-registry-table th:nth-child(4),
.client-registry-table td:nth-child(4),
.client-registry-table th:nth-child(8),
.client-registry-table td:nth-child(8),
.client-registry-table th:nth-child(9),
.client-registry-table td:nth-child(9),
.client-registry-table th:nth-child(10),
.client-registry-table td:nth-child(10) {
    width: 92px;
}

.client-registry-table th:nth-child(5),
.client-registry-table td:nth-child(5),
.client-registry-table th:nth-child(6),
.client-registry-table td:nth-child(6) {
    width: 118px;
}

.client-registry-table th:nth-child(7),
.client-registry-table td:nth-child(7) {
    width: 150px;
}

.client-registry-table th:nth-child(11),
.client-registry-table td:nth-child(11) {
    width: 110px;
}

.client-registry-table th:nth-child(12),
.client-registry-table td:nth-child(12) {
    width: 150px;
}

.client-subscription-detail {
    display: grid;
    gap: 0.75rem;
    overflow-x: auto;
}

.client-subscription-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.subscription-matrix-table {
    min-width: 980px;
    table-layout: fixed;
}

.subscription-matrix-table th:first-child,
.subscription-matrix-table td:first-child {
    width: 86px;
}

.subscription-matrix-table th:nth-child(2),
.subscription-matrix-table td:nth-child(2) {
    width: 130px;
}

.subscription-matrix-table th:nth-child(3),
.subscription-matrix-table td:nth-child(3) {
    width: 260px;
}

.subscription-matrix-table th:nth-child(4),
.subscription-matrix-table td:nth-child(4) {
    min-width: 96px;
}

.subscription-month-cell {
    position: relative;
    text-align: right;
    white-space: nowrap;
}

.subscription-month-cell strong,
.subscription-month-cell span,
.subscription-month-cell small {
    display: block;
    line-height: 1.2;
}

.subscription-month-cell span,
.subscription-month-cell small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.subscription-month-cell b {
    display: inline-flex;
    justify-content: flex-end;
    margin-top: 0.2rem;
    padding: 0.08rem 0.28rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.2;
}

.subscription-month-cell em {
    position: absolute;
    top: 0.2rem;
    left: 0.35rem;
    font-style: normal;
    font-weight: 900;
}

.subscription-month-cell.is-added {
    background: #ecfdf5;
    color: #047857;
}

.subscription-matrix-table tr:hover .subscription-month-cell.is-added {
    background: #ecfdf5;
}

.subscription-month-cell.is-removed {
    background: #fef2f2;
    color: #dc2626;
}

.subscription-matrix-table tr:hover .subscription-month-cell.is-removed {
    background: #fef2f2;
}

.subscription-month-cell.is-increased {
    background: #eff6ff;
    color: #2563eb;
}

.subscription-matrix-table tr:hover .subscription-month-cell.is-increased {
    background: #eff6ff;
}

.subscription-month-cell.is-decreased {
    background: #fff7ed;
    color: #b45309;
}

.subscription-matrix-table tr:hover .subscription-month-cell.is-decreased {
    background: #fff7ed;
}

.main-subnav {
    padding: 0;
    gap: 0.75rem;
}

.main-subnav-link {
    padding: 0.45rem 0.1rem;
    color: var(--text-muted);
}

.main-subnav-link.active {
    color: var(--primary-dark);
}

.dashboard-section {
    display: grid;
    gap: 1rem;
}

.dashboard-hero-card {
    display: none;
}

.ops-alert-list {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ops-alert-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem;
    background: #fff;
}

.ops-alert-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

@media (max-width: 980px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-nav {
        display: flex;
        gap: 1rem;
        overflow-x: auto;
    }

    .sidebar-group {
        min-width: 210px;
    }

    .app-topbar {
        position: relative;
        padding: 0.85rem 1rem;
    }

    .topbar-search {
        display: none;
    }

    .page-content {
        padding: 1rem;
    }

    .subscription-filters {
        grid-template-columns: 1fr;
    }
}

/* Compact control polish after legacy button rules */
.btn-primary,
.btn-secondary {
    width: auto;
    min-height: 2.55rem;
    padding: 0.62rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    white-space: nowrap;
    font-size: 0.88rem;
    line-height: 1.15;
}

.btn-small {
    width: auto;
    min-height: 2rem;
    padding: 0.38rem 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 0.8rem;
    line-height: 1.1;
}

.button-cell {
    display: flex;
    align-items: end;
    justify-content: flex-start;
    gap: 0.5rem;
    min-width: max-content;
}

.page-toolbar .button-cell {
    align-self: end;
}

.page-toolbar .btn-primary,
.page-toolbar .btn-secondary {
    min-width: 7.5rem;
}

.page-toolbar #clients-sync {
    min-width: 11rem;
}

.page-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.page-toolbar .button-cell {
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.page-toolbar .button-cell .btn-primary,
.page-toolbar .button-cell .btn-secondary {
    flex: 0 1 auto;
}

.filters-grid,
.page-toolbar,
.unpaid-filters {
    align-items: end;
}

.filters-grid label {
    min-width: 0;
}

@media (max-width: 760px) {
    .button-cell,
    .page-toolbar .button-cell {
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
    }

    .button-cell .btn-primary,
    .button-cell .btn-secondary {
        flex: 1 1 10rem;
    }
}

/* Document digitization proof of concept. */
.document-digitization-page {
    display: grid;
    gap: 1rem;
}

.digitization-upload-actions,
.digitization-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.digitization-file-label {
    cursor: pointer;
}

.digitization-selected-file {
    margin-top: 0.85rem;
    padding: 0.65rem 0.75rem;
    border-left: 3px solid var(--primary);
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.digitization-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.82fr) minmax(520px, 1.18fr);
    align-items: start;
    gap: 1rem;
}

.digitization-preview-card {
    position: sticky;
    top: 1rem;
}

.digitization-preview {
    min-height: 680px;
    margin-top: 0.85rem;
    border: 1px solid var(--border-color);
    background: #eef2f6;
}

.digitization-preview-frame {
    display: block;
    width: 100%;
    height: 680px;
    border: 0;
    background: #fff;
}

.digitization-preview-image {
    display: block;
    width: 100%;
    max-height: 780px;
    object-fit: contain;
    background: #fff;
}

.digitization-results-column,
#digitization-result {
    display: grid;
    gap: 1rem;
}

.digitization-empty-result .empty-state-card {
    margin: 0;
}

.digitization-section-header h3,
.digitization-section-header p {
    margin: 0;
}

.digitization-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0.9rem 0 0;
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.digitization-summary-grid > div {
    min-width: 0;
    padding: 0.72rem;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.digitization-summary-grid > div.is-wide {
    grid-column: span 2;
}

.digitization-summary-grid dt {
    margin-bottom: 0.18rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.digitization-summary-grid dd {
    margin: 0;
    color: var(--text-color);
    font-size: 0.88rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.digitization-warnings {
    margin-top: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-left: 3px solid var(--warning);
    background: #fff7ed;
    color: #8a4612;
    font-size: 0.82rem;
}

.digitization-warnings ul {
    margin: 0.4rem 0 0;
    padding-left: 1.15rem;
}

.digitization-lines-table-wrap {
    margin-top: 0.85rem;
}

.digitization-lines-table td:nth-child(2) {
    min-width: 230px;
}

.digitization-lines-table td:nth-child(2) strong,
.digitization-lines-table td:nth-child(2) span {
    display: block;
}

.digitization-raw-card summary {
    cursor: pointer;
    font-weight: 700;
}

.digitization-raw-card pre {
    max-height: 420px;
    overflow: auto;
    margin: 0.8rem 0 0;
    padding: 0.8rem;
    background: #111827;
    color: #e5e7eb;
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.digitization-raw-card .metric-sub {
    margin: 0.75rem 0 0;
}

.digitization-history-table-wrap {
    margin-top: 0.85rem;
}

.digitization-history-card {
    margin-top: 0.25rem;
}

.digitization-history-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}

.digitization-history-summary::-webkit-details-marker {
    display: none;
}

.digitization-history-summary > span:first-child,
.digitization-history-summary strong {
    display: block;
}

.digitization-history-summary strong {
    margin-top: 0.18rem;
    font-size: 1rem;
}

.digitization-history-summary::after {
    content: '⌄';
    margin-left: auto;
    color: var(--text-muted);
    font-size: 1.15rem;
    transition: transform 0.16s ease;
}

.digitization-history-card[open] .digitization-history-summary::after {
    transform: rotate(180deg);
}

.digitization-history-content {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.digitization-history-table-wrap td:nth-child(2) strong,
.digitization-history-table-wrap td:nth-child(2) span,
.digitization-import-lines td span,
.digitization-import-status span {
    display: block;
}

.digitization-history-open {
    white-space: nowrap;
}

.digitization-type-field {
    min-width: min(280px, 100%);
}

.digitization-type-field span,
.digitization-import-fields label > span {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.digitization-type-field select,
.digitization-import-fields select {
    width: 100%;
}

.digitization-classification-reason {
    margin: 0.9rem 0 0;
    padding: 0.75rem 0.85rem;
    border-left: 3px solid var(--primary);
    background: #f8fafc;
    font-size: 0.86rem;
    font-weight: 650;
}

.digitization-evidence {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.digitization-evidence ul {
    margin: 0.35rem 0 0;
    padding-left: 1.15rem;
}

.digitization-import-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.digitization-import-fields {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 0.35fr);
    gap: 0.75rem;
    margin-top: 0.95rem;
}

.digitization-supplier-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
}

.digitization-supplier-field label {
    min-width: 0;
}

.digitization-import-status {
    display: grid;
    gap: 0.18rem;
    margin-top: 0.85rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.digitization-import-status strong {
    color: var(--text-color);
    font-size: 0.9rem;
}

.digitization-import-blockers.is-ready,
.digitization-warnings.is-ready {
    border-left-color: #198754;
    background: #ecfdf3;
    color: #166534;
}

.digitization-import-lines {
    margin-top: 0.85rem;
}

.digitization-create-line {
    display: block;
    margin-top: 0.45rem;
    white-space: nowrap;
}

.digitization-create-modal-card {
    width: min(760px, 96vw);
    max-height: min(88vh, 880px);
    overflow: auto;
    padding: 1.25rem;
}

.digitization-create-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.digitization-batch-list {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    max-height: 220px;
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
}

.digitization-batch-list[hidden] {
    display: none;
}

.digitization-batch-list > div {
    display: grid;
    grid-template-columns: 3rem minmax(8rem, 0.45fr) minmax(12rem, 1fr);
    gap: 0.6rem;
    font-size: 0.86rem;
}

.peppol-nomenclature-batch-actions {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 0.5rem;
}

.digitization-create-form label {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.digitization-create-form label > span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.digitization-create-form input,
.digitization-create-form select {
    width: 100%;
}

.digitization-create-form .is-wide {
    grid-column: 1 / -1;
}

.digitization-checkbox-field {
    display: flex !important;
    align-items: center;
    grid-template-columns: auto 1fr;
    gap: 0.45rem !important;
}

.digitization-checkbox-field input {
    width: auto;
}

.digitization-group-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
}

.digitization-group-field select {
    grid-column: 1 / -1;
}

.digitization-create-footer p {
    margin: 0;
}

@media (max-width: 1180px) {
    .digitization-workspace {
        grid-template-columns: 1fr;
    }

    .digitization-preview-card {
        position: static;
    }

    .digitization-preview,
    .digitization-preview-frame {
        min-height: 560px;
        height: 560px;
    }
}

@media (max-width: 760px) {
    .digitization-upload-actions,
    .digitization-section-header,
    .digitization-import-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .digitization-import-fields {
        grid-template-columns: 1fr;
    }

    .digitization-supplier-field,
    .digitization-create-form,
    .digitization-group-field {
        grid-template-columns: 1fr;
    }

    .digitization-create-form .is-wide,
    .digitization-group-field select {
        grid-column: auto;
    }

    .digitization-batch-list > div {
        grid-template-columns: 2.5rem 1fr;
    }

    .digitization-batch-list > div span:last-child {
        grid-column: 2;
    }

    .digitization-summary-grid {
        grid-template-columns: 1fr;
    }

    .digitization-summary-grid > div.is-wide {
        grid-column: auto;
    }

    .digitization-preview,
    .digitization-preview-frame {
        min-height: 420px;
        height: 420px;
    }
}

.documents-workspace {
    display: grid;
    gap: 1.35rem;
}

.documents-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.9fr);
    gap: 1.1rem;
    align-items: stretch;
}

.documents-hero-copy,
.documents-hero-note {
    border: 1px solid rgba(193, 174, 155, 0.82);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
}

.documents-hero-copy {
    padding: 1.5rem 1.6rem;
    background:
        radial-gradient(120% 160% at 0% 0%, rgba(208, 54, 19, 0.13), transparent 55%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(250, 246, 241, 0.93));
}

.documents-hero-note {
    padding: 1.25rem 1.3rem;
    background:
        linear-gradient(180deg, rgba(247, 240, 232, 0.94), rgba(255, 255, 255, 0.98));
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.documents-hero-kicker,
.documents-hero-note-label {
    margin: 0;
    color: var(--primary-dark);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.documents-hero-copy .page-description {
    margin-bottom: 0;
}

.documents-hero-note strong {
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.documents-hero-note p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.45;
}

.documents-card {
    padding: 1.35rem;
    box-shadow: var(--shadow-lift);
}

.documents-card-header {
    margin-bottom: 1.05rem;
}

.documents-filters-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem 1rem;
    padding: 1rem;
    border: 1px solid rgba(193, 174, 155, 0.68);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 241, 234, 0.88));
}

.documents-filter {
    min-width: 0;
}

.documents-filter > span {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6f5546;
}

.documents-filter-checkbox {
    justify-content: flex-end;
}

.documents-filter-action {
    justify-content: flex-start;
}

.documents-filter-action .btn-primary {
    min-width: 10.5rem;
}

.documents-tab-bar {
    margin-top: 1rem;
    background: rgba(249, 244, 238, 0.9);
    border: 1px solid rgba(193, 174, 155, 0.74);
    border-radius: 10px;
    padding: 0.35rem;
    gap: 0.4rem;
}

.documents-summary-inline {
    margin-top: 0.9rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(193, 174, 155, 0.7);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 241, 234, 0.9));
    box-shadow: var(--shadow-soft);
}

.documents-loading-inline {
    margin-top: 0.8rem;
}

.documents-cache-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.85rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(193, 174, 155, 0.68);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: var(--shadow-soft);
}

.documents-cache-actions.is-stale {
    border-color: rgba(154, 77, 20, 0.28);
    background: rgba(154, 77, 20, 0.08);
}

.supplier-payables-status-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 0;
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.supplier-payables-status-metric {
    display: grid;
    gap: 0.35rem;
    padding: 0.8rem 1rem;
    border-right: 1px solid var(--border);
    background: #fff;
}

.supplier-payables-status-metric:last-child {
    border-right: 0;
}

.supplier-payables-status-metric span {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.supplier-payables-status-metric strong {
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.supplier-payables-status-metric.is-out strong {
    color: #c24137;
}

.supplier-payables-status-metric.is-in strong {
    color: #087a58;
}

.supplier-payables-status-metric.is-warning strong {
    color: #a15b11;
}

.supplier-payables-load-filters {
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(240px, 1.4fr) auto;
}

.supplier-payables-table-filters {
    grid-template-columns: minmax(260px, 2fr) minmax(180px, 0.8fr);
}

.supplier-payables-summary {
    margin: 0 0 16px;
}

.supplier-payables-status-summary {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    margin: 0 0 12px;
}

.supplier-payables-totals-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.supplier-payables-total-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
    padding: 14px 16px;
    border-right: 1px solid var(--border);
}

.supplier-payables-total-block:last-child {
    border-right: 0;
}

.supplier-payables-total-block.is-total {
    background: var(--surface-muted);
}

.supplier-payables-total-heading {
    grid-column: 1 / -1;
    display: grid;
    gap: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.supplier-payables-total-heading strong {
    font-size: 0.95rem;
}

.supplier-payables-total-heading span,
.supplier-payables-total-block > div:not(.supplier-payables-total-heading) span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.supplier-payables-total-block > div:not(.supplier-payables-total-heading) {
    display: grid;
    gap: 4px;
}

.supplier-payables-total-block > div:not(.supplier-payables-total-heading) strong {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1200px) {
    .supplier-payables-totals-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .supplier-payables-total-block:nth-child(2) {
        border-right: 0;
    }

    .supplier-payables-total-block:nth-child(-n + 2) {
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 760px) {
    .supplier-payables-status-summary,
    .supplier-payables-totals-grid {
        grid-template-columns: 1fr;
    }

    .supplier-payables-status-metric,
    .supplier-payables-total-block {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .supplier-payables-status-metric:last-child,
    .supplier-payables-total-block:last-child {
        border-bottom: 0;
    }

    .supplier-payables-status-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .supplier-payables-status-chips {
        justify-content: flex-start;
    }

    .supplier-payables-status-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}

.supplier-payables-table-wrap {
    margin-top: 10px;
}

.supplier-payables-table td {
    vertical-align: top;
}

.supplier-payables-status-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 12px 0 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.supplier-payables-sort-note {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.supplier-payables-status-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.supplier-payables-status-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.supplier-payables-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.supplier-payables-status-chip:hover,
.supplier-payables-status-chip.is-active {
    border-color: #ef4444;
    background: #fff5f5;
    color: #b42318;
}

.supplier-payables-status-chip strong {
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.supplier-payables-status-chip.is-active strong,
.supplier-payables-status-chip:hover strong {
    background: #ef4444;
    color: #fff;
}

.supplier-payables-overdue-row td:first-child {
    box-shadow: inset 3px 0 0 #ef4444;
}

.supplier-payables-overdue-row {
    background: #fff5f5;
}

.supplier-payables-due-today-row {
    background: #fff9eb;
}

.supplier-payables-due-today-row td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

.supplier-payables-due-tomorrow-row {
    background: #f3f8ff;
}

.supplier-payables-due-tomorrow-row td:first-child {
    box-shadow: inset 3px 0 0 #3b82f6;
}

.supplier-payables-paid-row {
    background: #f4fbf7;
}

.supplier-payables-paid-row td:first-child {
    box-shadow: inset 3px 0 0 #16a34a;
}

.supplier-payables-review-row {
    background: #fff7ed;
}

.supplier-payables-review-row td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

.supplier-payables-detail-copy {
    padding: 14px 16px;
    color: var(--text-muted);
}

.documents-cache-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.documents-table-shell {
    margin-top: 0.9rem;
    border-radius: 10px;
    border-color: rgba(193, 174, 155, 0.76);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.documents-table-shell table {
    min-width: 760px;
}

.documents-table-shell thead th {
    background: linear-gradient(180deg, #f7efe8, #f2e7de);
}

.documents-table-shell tbody tr:nth-child(even) {
    background: rgba(250, 246, 241, 0.65);
}

.documents-table-shell tbody tr:hover {
    background: rgba(247, 237, 227, 0.92);
}

.documents-table-shell td:nth-child(2),
.documents-table-shell td:first-child {
    font-weight: 700;
}

.documents-table-shell td:nth-child(5),
.documents-table-shell td:nth-child(6) {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .statistics-filters {
        position: static;
    }

    .app-shell {
        padding: 1.5rem 1rem 2.5rem;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .app-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .main-nav {
        width: 100%;
        padding: 0.8rem;
    }

    .main-nav-primary {
        gap: 1rem;
        padding-bottom: 0.6rem;
    }

    .main-subnav {
        gap: 0.85rem;
        padding-top: 0.6rem;
    }

    .main-nav-link,
    .main-subnav-link {
        font-size: 0.92rem;
    }

    .settings-tab-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    table {
        min-width: auto;
    }

    .stat-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .chart-canvas {
        height: 260px;
    }

    .tracking-detail-grid {
        grid-template-columns: 1fr;
    }

    .tracking-timeline-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .unpaid-grid {
        grid-template-columns: 1fr;
    }

    .comparison-table td {
        white-space: normal;
    }

    .auth-shell {
        padding: 2.2rem 1rem 2rem;
    }

    .auth-card {
        padding: 2.8rem 1.25rem 2rem;
        border-radius: 14px;
    }

    .auth-card h1 {
        margin: 1.8rem 0 2rem;
        font-size: 1.35rem;
    }

    .auth-brand-logo {
        max-width: min(220px, 100%);
    }

    .documents-hero {
        grid-template-columns: 1fr;
    }

    .documents-card {
        padding: 1rem;
    }

    .documents-filters-grid {
        padding: 0.85rem;
    }

    .documents-filter-action .btn-primary {
        width: 100%;
    }

    .documents-cache-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .documents-cache-buttons {
        justify-content: flex-start;
    }
}

/* Flat operations UI reset: this intentionally wins over legacy beige/card styles above. */
html,
body,
.app-layout,
.app-main-shell {
    background: #f8fafc !important;
    color: #111827;
}

body {
    font-family: var(--app-font-family);
}

.app-sidebar,
.app-topbar,
.card,
.stat-card,
.dashboard-hero-card,
.dashboard-note-card,
.dashboard-alerts-card,
.tracking-stat-card,
.settings-sidebar-card,
.settings-content,
.filters-grid,
.page-toolbar,
.unpaid-filters,
.table-responsive,
.data-table-shell,
.documents-table-shell,
.documents-hero-copy,
.documents-hero-note,
.documents-card,
.documents-filters-grid,
.documents-results-card,
.documents-cache-panel,
.received-detail-panel,
.vendor-nom-group-selected,
.vendor-nom-modal-card,
.client-registry-filters,
.subscription-filters,
.ops-alert-item,
.topbar-search,
.topbar-user,
.icon-button,
.user-chip,
.main-nav,
.app-header {
    border-color: #e5e7eb !important;
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.app-sidebar {
    padding: 1.25rem 1rem;
    border-right: 1px solid #e2e8f0 !important;
}

.app-topbar {
    min-height: 64px;
    border-bottom: 1px solid #e2e8f0 !important;
}

.page-content {
    background: #f8fafc;
}

.page-content > section {
    gap: 1rem;
}

.page-title {
    color: #0f172a;
    font-size: 1.55rem;
    font-weight: 850;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.page-description,
.subtitle,
.card-header p,
.section-header p,
.metric-sub,
.stat-meta {
    color: #64748b !important;
}

.card,
.stat-card,
.filters-grid,
.page-toolbar,
.unpaid-filters,
.table-responsive,
.documents-table-shell,
.documents-card,
.documents-filters-grid,
.documents-results-card,
.client-registry-filters,
.subscription-filters {
    border-radius: 8px !important;
}

.card,
.documents-card,
.documents-results-card {
    padding: 1rem;
}

.stat-card {
    min-height: 5.8rem;
    padding: 0.9rem 1rem;
    gap: 0.2rem;
}

.stat-card h3,
.card-header h3,
.section-header h3 {
    color: #0f172a;
}

.stat-card h3,
.data-table th,
table th,
.section-kicker,
.documents-hero-kicker,
.documents-hero-note-label {
    color: #64748b !important;
    letter-spacing: 0.04em;
}

.stat-value {
    color: #0f172a;
}

.sidebar-link {
    min-height: 2.35rem;
    border: 1px solid transparent !important;
    border-radius: 8px;
    background: transparent !important;
    color: #334155;
    box-shadow: none !important;
}

.sidebar-link:hover {
    border-color: #eef2f7 !important;
    background: #f8fafc !important;
    color: #0f172a;
}

.sidebar-link.active {
    border-color: #fee2e2 !important;
    background: #fff1f2 !important;
    color: #dc2626 !important;
    box-shadow: inset 3px 0 0 #ef4444 !important;
}

.sidebar-link-icon {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

.sidebar-link.active .sidebar-link-icon {
    background: #fee2e2 !important;
    color: #ef4444 !important;
}

.app-brand-mark {
    color: #ef1f1f !important;
}

.app-brand-sub,
.sidebar-group-label {
    color: #64748b !important;
}

.topbar-search,
.topbar-user,
.icon-button {
    border-color: #e5e7eb !important;
    border-radius: 8px;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.client-registry-input,
.subscription-filters input[type="search"],
.client-registry-filters input,
.client-registry-filters select {
    border-color: #dbe3ee !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
.client-registry-input:focus {
    border-color: #93c5fd !important;
    outline: 3px solid rgba(59, 130, 246, 0.12) !important;
    box-shadow: none !important;
}

.auth-input-wrap:focus-within {
    border-color: #93a4bb !important;
    box-shadow: none !important;
}

.auth-input-wrap input,
.auth-input-wrap input:focus,
.auth-input-wrap input:focus-visible {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

.btn-primary {
    border-color: #dc2626 !important;
    background: #ef3124 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.btn-primary:hover {
    background: #dc2626 !important;
}

.btn-secondary,
.btn-small,
.icon-button,
button:not(.main-subnav-link):not(.sidebar-link) {
    box-shadow: none !important;
}

.btn-secondary,
.btn-small,
.icon-button {
    border-color: #dbe3ee !important;
    background: #ffffff !important;
    color: #1f2937 !important;
}

.btn-secondary:hover,
.btn-small:hover,
.icon-button:hover {
    border-color: #cbd5e1 !important;
    background: #f8fafc !important;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-small:hover {
    transform: none !important;
}

.data-table th,
table th,
.documents-table-shell thead th {
    background: #f8fafc !important;
    color: #64748b !important;
}

.data-table td,
table td {
    background: #ffffff;
}

.data-table tr:hover td,
.documents-table-shell tbody tr:hover {
    background: #f8fafc !important;
}

.documents-table-shell tbody tr:nth-child(even),
.data-table-shell tbody tr:nth-child(even) {
    background: #ffffff !important;
}

.alert,
.alert-error,
.alert-warning,
.alert-info,
.alert-success,
.status-pill {
    box-shadow: none !important;
}

.status-pill {
    border-radius: 999px;
}

.documents-hero {
    gap: 0.75rem;
}

.documents-card-header,
.documents-cache-panel {
    background: #f8fafc !important;
    background-image: none !important;
}

.subscription-month-cell.is-added,
.subscription-matrix-table tr:hover .subscription-month-cell.is-added {
    background: #ecfdf5 !important;
}

.subscription-month-cell.is-removed,
.subscription-matrix-table tr:hover .subscription-month-cell.is-removed {
    background: #fef2f2 !important;
}

.subscription-month-cell.is-increased,
.subscription-matrix-table tr:hover .subscription-month-cell.is-increased {
    background: #eff6ff !important;
}

.subscription-month-cell.is-decreased,
.subscription-matrix-table tr:hover .subscription-month-cell.is-decreased {
    background: #fff7ed !important;
}

.modal-card,
.tracking-modal-dialog {
    border-color: #e5e7eb !important;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.14) !important;
}

/* Final flat page chrome pass: headings, tabs, and inline summaries. */
.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-heading-row .page-title,
.page-heading-row .page-description {
    margin-left: 0;
    margin-right: 0;
}

.page-heading-row .page-title {
    margin-bottom: 0.25rem !important;
}

.page-heading-row .page-description {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    max-width: min(760px, 100%) !important;
    line-height: 1.5 !important;
}

.page-heading-row .btn-primary,
.page-heading-row .btn-secondary {
    flex: 0 0 auto;
    margin-top: 0.1rem;
}

.page-content > section:not(.documents-workspace) > .page-title:first-child,
.page-content > section:not(.documents-workspace) > .page-title:first-child + .page-description,
.documents-hero-copy {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.page-content > section > .page-title,
.documents-hero-copy .page-title {
    display: block !important;
    max-width: 100% !important;
    line-height: 1.2 !important;
}

.page-content > section > .page-description,
.documents-hero-copy .page-description {
    display: block !important;
    max-width: min(72rem, 100%) !important;
    clear: both !important;
    line-height: 1.55 !important;
    overflow-wrap: anywhere !important;
}

.page-content > section:not(.documents-workspace) > .page-title:first-child {
    margin-bottom: 0.35rem !important;
}

.page-content > section:not(.documents-workspace) > .page-title:first-child + .page-description {
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
}

.documents-hero {
    display: block !important;
    margin-bottom: 1rem;
}

.documents-hero-note {
    display: none !important;
}

.documents-hero-kicker {
    margin-bottom: 0.45rem !important;
}

.documents-hero-copy .page-title {
    margin: 0 0 0.25rem !important;
}

.documents-hero-copy .page-description {
    margin: 0 0 1rem !important;
}

.tab-bar,
.documents-tab-bar,
.workspace-tab-bar,
.settings-tab-bar,
.main-subnav {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 1rem !important;
    width: auto !important;
    margin: 0 0 0.85rem !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.tab-button,
.main-subnav-link {
    min-height: 2.2rem !important;
    padding: 0.35rem 0 0.45rem !important;
    border: 0 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    color: #64748b !important;
    box-shadow: none !important;
    font-weight: 750;
}

.tab-button:hover,
.main-subnav-link:hover {
    background: transparent !important;
    color: #0f172a !important;
}

.tab-button.active,
.main-subnav-link.active {
    background: transparent !important;
    color: #ef1f1f !important;
    border-bottom-color: #ef1f1f !important;
    box-shadow: none !important;
}

.tab-button::after,
.main-subnav-link::after {
    display: none !important;
}

.settings-tab-bar .tab-button {
    width: auto !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

.summary-inline,
.workspace-summary-bar,
.documents-summary-inline,
.document-lines-summary,
.tracking-invoice-summary {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.summary-inline,
.documents-summary-inline,
.workspace-summary-bar {
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline !important;
    gap: 0.45rem !important;
    margin: 0.65rem 0 1rem !important;
    padding: 0 !important;
    color: #64748b !important;
}

.documents-export-button {
    margin-left: auto;
}

.summary-inline strong,
.documents-summary-inline strong,
.workspace-summary-bar strong {
    color: #0f172a !important;
}

.document-lines-summary,
.tracking-invoice-summary {
    padding: 0 !important;
    gap: 0.75rem !important;
}

.document-lines-summary-item,
.tracking-invoice-summary-card {
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.tracking-dashboard-shell {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.tracking-dashboard-hero,
.tracking-detail-card-issues {
    background: #ffffff !important;
    background-image: none !important;
}

.tracking-dashboard-sync-strip {
    margin-top: 1rem !important;
    padding-top: 0.85rem !important;
    border-top: 1px solid #e5e7eb !important;
}

.tracking-stat-card,
.tracking-window-card,
.tracking-detail-card,
.tracking-card {
    border-color: #e5e7eb !important;
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
}

.tracking-window-card-transit,
.tracking-window-card-out,
.tracking-stat-card-alert {
    border-top: 1px solid #e5e7eb !important;
}

.tracking-card {
    border-radius: 8px !important;
}

.tracking-card::before {
    width: 3px !important;
}

.tracking-card-timeline {
    border-top-color: #e5e7eb !important;
}

.tracking-card-kicker {
    color: #64748b !important;
    letter-spacing: 0.04em;
}

/* Dashboard and expanded document cleanup. */
.dashboard-page,
.dashboard-page *,
.documents-workspace,
.documents-workspace * {
    min-width: 0;
}

.dashboard-page .page-heading-row > div {
    min-width: 0;
}

.dashboard-page .page-heading-row .btn-secondary {
    white-space: nowrap;
}

.dashboard-stack,
.dashboard-section,
.dashboard-section-horizon,
.dashboard-section-operations {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.dashboard-stack,
.dashboard-section {
    gap: 1rem !important;
}

.dashboard-grid-primary,
.dashboard-grid-secondary {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)) !important;
    margin: 0 !important;
}

.dashboard-page .stat-card {
    min-height: auto !important;
    overflow: visible !important;
}

.dashboard-page .stat-card::after {
    display: none !important;
}

.dashboard-page .stat-value,
.dashboard-page .stat-meta,
.dashboard-page .metric-sub,
.dashboard-page .card-header p,
.dashboard-page .section-header p,
.dashboard-page .note-list,
.dashboard-page .ops-alert-item,
.dashboard-page .ops-alert-item-copy,
.dashboard-page .ops-alert-item-meta {
    overflow-wrap: anywhere !important;
    word-break: normal;
}

.dashboard-note-card,
.dashboard-alerts-card {
    border-color: #e5e7eb !important;
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
}

.dashboard-page .card-header {
    border-bottom-color: #e5e7eb !important;
}

.dashboard-page .note-list {
    padding-left: 1rem !important;
}

.dashboard-page .code-span {
    white-space: normal !important;
}

.document-lines-row > td,
.document-raw-row td {
    padding: 0.85rem 1rem 1rem !important;
    background: #f8fafc !important;
    background-image: none !important;
    border-top: 1px solid #e5e7eb !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.document-lines-panel {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.document-lines-header {
    align-items: flex-start !important;
    flex-wrap: wrap;
    margin: 0 0 0.75rem !important;
    padding: 0 !important;
    border-bottom: 0 !important;
}

.document-lines-header strong,
.document-lines-summary-item strong,
.document-lines-panel td,
.document-lines-panel th {
    overflow-wrap: anywhere !important;
}

.document-lines-summary {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)) !important;
}

.document-lines-summary-item {
    border-color: #e5e7eb !important;
}

.document-lines-panel .nested-table {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.document-lines-panel .nested-table table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse !important;
}

.document-lines-panel .nested-table thead th,
.document-lines-panel .nested-table tbody tr:nth-child(even),
.document-lines-panel .nested-table tbody tr:hover {
    background: #f8fafc !important;
    background-image: none !important;
}

.document-lines-panel .nested-table thead th {
    padding: 0.65rem 0.85rem !important;
    border-bottom: 1px solid #e5e7eb !important;
    color: #64748b !important;
    font-size: 0.74rem !important;
    letter-spacing: 0.04em !important;
}

.document-lines-panel .nested-table td {
    padding: 0.7rem 0.85rem !important;
    border-bottom: 1px solid #eef2f7 !important;
    background: #ffffff !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
}

.document-lines-panel .nested-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

.document-lines-panel .nested-table th:first-child,
.document-lines-panel .nested-table td:first-child {
    width: 3.5rem;
    text-align: center;
}

.document-lines-panel .nested-table th:nth-child(4),
.document-lines-panel .nested-table td:nth-child(4),
.document-lines-panel .nested-table th:nth-child(6),
.document-lines-panel .nested-table td:nth-child(6),
.document-lines-panel .nested-table th:nth-child(7),
.document-lines-panel .nested-table td:nth-child(7) {
    text-align: right;
}

.documents-table-shell tr[data-expanded="1"] td,
.data-table-shell:not(.file-management-table) tr[data-expanded="1"] td {
    background: #f8fafc !important;
}

@media (max-width: 760px) {
    .page-heading-row {
        display: grid;
    }

    .page-heading-row .btn-primary,
    .page-heading-row .btn-secondary {
        width: 100%;
    }
}

/* Arrow licence changes report */
.reports-arrow-consumption-page {
    display: grid;
    gap: 1rem;
}

.report-export-button[hidden],
.licence-report-loading[hidden] {
    display: none !important;
}

.report-filters-card,
.licence-report-loading,
.licence-summary-card {
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
}

.report-filters-card {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.report-filters-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.report-filters-header h3 {
    margin: 0 0 0.2rem;
    color: #111827;
    font-size: 1rem;
    font-weight: 900;
}

.report-filters-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.45;
}

.report-filter-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.report-filter-grid {
    display: grid;
    grid-template-columns: minmax(18rem, 1.35fr) minmax(12rem, 0.9fr) repeat(2, minmax(10rem, 0.7fr)) minmax(13rem, 1fr) minmax(12rem, auto);
    gap: 0.75rem;
    align-items: end;
}

.report-filter-grid label {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.report-filter-grid label > span,
.report-checkbox-row span {
    color: #56657a;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.report-filter-grid input,
.report-filter-grid select {
    width: 100%;
    min-width: 0;
    height: 2.6rem;
}

.incoming-waybills-page {
    display: grid;
    gap: 1rem;
}

.incoming-waybills-filter-grid {
    display: grid;
    grid-template-columns: minmax(18rem, 1.4fr) minmax(12rem, 0.8fr) repeat(2, minmax(11rem, 0.7fr));
    gap: 0.75rem;
    align-items: end;
}

.incoming-waybills-filter-grid label {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.incoming-waybills-filter-grid label > span {
    color: #56657a;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.incoming-waybills-filter-grid input,
.incoming-waybills-filter-grid select {
    width: 100%;
    min-width: 0;
    height: 2.6rem;
}

.incoming-waybills-select-column {
    width: 2.75rem;
    text-align: center;
}

.incoming-waybills-select-column input {
    width: 1rem;
    height: 1rem;
}

@media (max-width: 980px) {
    .incoming-waybills-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .incoming-waybills-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* MikroTik Fleet */
.mikrotik-summary-grid {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.mikrotik-filters {
    grid-template-columns: minmax(180px, 1.4fr) repeat(7, minmax(125px, 1fr));
}

.mikrotik-fleet-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 1rem;
    align-items: start;
}

.mikrotik-devices-table tbody tr {
    cursor: pointer;
}

.mikrotik-devices-table tbody tr:hover {
    background: #f8fafc;
}

.mikrotik-version-panel {
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 1rem;
}

.mikrotik-version-panel h3 {
    margin: 0 0 0.6rem;
    font-size: 0.9rem;
}

.mikrotik-version-panel h3:not(:first-child) {
    margin-top: 1.2rem;
}

.mikrotik-version-list {
    display: grid;
    gap: 0.4rem;
}

.mikrotik-version-list > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.mikrotik-device-modal-card {
    width: min(1120px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.mikrotik-device-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.mikrotik-device-form {
    margin: 0;
}

.mikrotik-live-detail,
.mikrotik-onboarding,
.mikrotik-history-section {
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 1rem;
}

.mikrotik-onboarding,
.mikrotik-history-section {
    margin: 0 1.25rem 1rem;
}

.mikrotik-live-detail h4,
.mikrotik-onboarding h4,
.mikrotik-history-section h4 {
    margin: 0 0 0.75rem;
}

.mikrotik-device-facts {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 0.45rem 0.75rem;
    margin: 0;
    font-size: 0.86rem;
}

.mikrotik-device-facts dt {
    color: #64748b;
}

.mikrotik-device-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.mikrotik-onboarding textarea {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    background: #0f172a;
    color: #e2e8f0;
    font-family: Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
    resize: vertical;
}

.mikrotik-credential-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mikrotik-credential-row code {
    padding: 0.4rem 0.55rem;
    background: #f1f5f9;
    overflow-wrap: anywhere;
}

.mikrotik-modal-spacer {
    flex: 1 1 auto;
}

.text-danger {
    color: #b91c1c;
}

@media (max-width: 1180px) {
    .mikrotik-summary-grid {
        grid-template-columns: repeat(4, minmax(130px, 1fr));
    }
    .mikrotik-filters {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
    .mikrotik-fleet-layout {
        grid-template-columns: 1fr;
    }
    .mikrotik-version-panel {
        display: grid;
        grid-template-columns: auto 1fr auto 1fr;
        gap: 1rem;
    }
    .mikrotik-version-panel h3:not(:first-child) {
        margin-top: 0;
    }
}

@media (max-width: 760px) {
    .mikrotik-summary-grid,
    .mikrotik-filters,
    .mikrotik-device-modal-grid,
    .mikrotik-version-panel {
        grid-template-columns: 1fr;
    }
}

.report-client-search-input-wrap {
    position: relative;
    display: block;
}

.report-client-search-input-wrap::after {
    content: "";
    position: absolute;
    left: 0.85rem;
    top: 50%;
    width: 0.48rem;
    height: 0.48rem;
    border: 2px solid #64748b;
    border-radius: 50%;
    transform: translateY(-55%);
    pointer-events: none;
}

.report-client-search-input-wrap::before {
    content: "";
    position: absolute;
    left: 1.35rem;
    top: calc(50% + 0.25rem);
    z-index: 1;
    width: 0.42rem;
    height: 2px;
    border-radius: 2px;
    background: #64748b;
    transform: rotate(45deg);
    pointer-events: none;
}

.report-search-field input {
    padding-left: 2.35rem;
}

.report-client-combobox {
    position: relative;
}

.report-client-suggestions {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    display: grid;
    max-height: 20rem;
    overflow: auto;
    padding: 0.35rem;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.report-client-suggestions[hidden] {
    display: none !important;
}

.report-client-suggestion {
    display: grid;
    gap: 0.15rem;
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.report-client-suggestion:hover,
.report-client-suggestion:focus-visible {
    background: #f8fafc;
    outline: none;
}

.report-client-suggestion strong {
    color: #111827;
    font-size: 0.9rem;
    font-weight: 900;
}

.report-client-suggestion span,
.report-client-suggestion-empty {
    color: #64748b;
    font-size: 0.82rem;
}

.report-client-suggestion-empty {
    padding: 0.7rem;
}

.report-selected-clients {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 0;
}

.report-selected-clients[hidden] {
    display: none !important;
}

.report-selected-client {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    min-height: 1.9rem;
    padding: 0.25rem 0.35rem 0.25rem 0.55rem;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 800;
}

.report-selected-client strong,
.report-selected-client em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-selected-client em {
    color: #64748b;
    font-style: normal;
    font-weight: 700;
}

.report-selected-client button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 0;
    border-radius: 50%;
    background: #e2e8f0;
    color: #334155;
    cursor: pointer;
    font-weight: 900;
}

.report-customer-selection-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: start;
    min-height: 2rem;
    padding-top: 0.1rem;
}

.report-all-customers-row {
    width: fit-content;
    min-height: 1.9rem;
    padding: 0 !important;
    white-space: nowrap;
}

.report-selected-client-all {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.report-checkbox-row {
    display: flex !important;
    flex-direction: row;
    align-items: center !important;
    min-height: 2.6rem;
    padding: 0.65rem 0;
}

.report-checkbox-row input {
    width: 1rem;
    height: 1rem;
}

.licence-report-loading {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    color: #64748b;
}

.loading-skeleton-line,
.loading-skeleton-grid span {
    min-height: 1rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7);
}

.loading-skeleton-line {
    width: min(24rem, 80%);
}

.loading-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.loading-skeleton-grid span {
    min-height: 4rem;
    border-radius: 8px;
}

.licence-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.licence-summary-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "icon label"
        "icon value"
        "icon meta";
    column-gap: 0.85rem;
    align-items: center;
    min-width: 0;
    padding: 1rem;
}

.licence-summary-card .licence-summary-icon { grid-area: icon; }

.licence-summary-card h3 {
    grid-area: label;
    margin: 0;
    color: #56657a;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.licence-summary-card .stat-value {
    grid-area: value;
    margin: 0.2rem 0 0;
    color: #0f172a;
    font-size: clamp(1.25rem, 1.8vw, 1.65rem);
    font-weight: 900;
    line-height: 1.1;
}

.licence-summary-card .stat-meta {
    grid-area: meta;
    color: #64748b;
    font-size: 0.85rem;
}

.licence-summary-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 900;
}

.licence-summary-icon-blue { color: #2563eb; background: #eaf1ff; }
.licence-summary-icon-purple { color: #7c3aed; background: #f1e9ff; }
.licence-summary-icon-green { color: #059669; background: #e9f9ef; }
.licence-summary-icon-yellow { color: #b45309; background: #fff4d8; }

.licence-results-section {
    display: grid;
    gap: 0;
    min-width: 0;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.licence-results-section[hidden] {
    display: none !important;
}

.licence-results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #dbe3ee;
}

.licence-results-heading h3 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
    font-weight: 900;
}

.licence-results-heading p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.84rem;
}

.licence-results-section .table-container {
    border: 0;
    border-radius: 0;
}

.licence-report-table {
    min-width: 68rem;
}

.licence-report-table th,
.licence-report-table td {
    vertical-align: top;
}

.licence-report-table tbody tr.licence-report-row:hover {
    background: #f8fafc;
}

.licence-report-table tbody tr.licence-report-row[data-detail-target] {
    cursor: pointer;
}

.licence-report-table tbody tr.licence-report-row[data-detail-target]:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}

.licence-report-table tbody tr.licence-report-row[data-expanded="1"] td {
    background: #f8fafc;
}

.licence-renewal-cell {
    display: grid;
    gap: 0.15rem;
}

.licence-renewal-cell strong {
    color: #111827;
    font-weight: 900;
}

.licence-renewal-cell span {
    width: fit-content;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
}

.licence-renewal-ok span {
    color: #047857;
    background: #dff7e8;
}

.licence-renewal-soon span {
    color: #92400e;
    background: #fef3c7;
}

.licence-renewal-overdue span {
    color: #b91c1c;
    background: #fee2e2;
}

.licence-renewal-missing span {
    color: #64748b;
    background: #f1f5f9;
}

.licence-customer-group-row td {
    padding: 0.8rem 1rem !important;
    border-top: 2px solid #cbd5e1;
    border-bottom: 1px solid #dbe3ee;
    background: #f6f8fb;
}

.licence-customer-group-row .licence-customer-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.licence-customer-group-row .app-table-state-cell {
    text-align: left !important;
}

.licence-customer-group-row .app-table-state-cell::before,
.licence-detail-row .app-table-state-cell::before {
    display: none !important;
    content: none !important;
}

.licence-customer-identity {
    display: grid;
    gap: 0.08rem;
}

.licence-customer-identity strong {
    color: #111827;
    font-size: 0.98rem;
    font-weight: 900;
}

.licence-customer-identity small,
.licence-customer-summary small {
    color: #64748b;
    font-size: 0.78rem;
}

.licence-customer-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.licence-customer-summary > span,
.licence-customer-summary > strong {
    display: inline-flex;
    align-items: center;
    min-height: 1.65rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.78rem;
    font-weight: 850;
    white-space: nowrap;
}

.licence-movement-up {
    color: #047857 !important;
}

.licence-movement-down {
    color: #b91c1c !important;
}

.licence-movement-net {
    color: #334155 !important;
}

.licence-event-chip-created,
.licence-event-chip-activated {
    border-color: #bbf7d0 !important;
    background: #ecfdf5 !important;
    color: #047857 !important;
}

.licence-event-chip-renewed {
    border-color: #bfdbfe !important;
    background: #eff6ff !important;
    color: #1d4ed8 !important;
}

.licence-event-chip-cancelled {
    border-color: #fecaca !important;
    background: #fef2f2 !important;
    color: #b91c1c !important;
}

.licence-event-chip-terms_changed,
.licence-event-chip-price_changed,
.licence-event-chip-status_changed {
    border-color: #fde68a !important;
    background: #fffbeb !important;
    color: #92400e !important;
}

.licence-event-chip-updated {
    border-color: #dbe3ee !important;
    background: #f8fafc !important;
    color: #475569 !important;
}

/* Arrow Microsoft licence renewals. */
.reports-arrow-renewals-page {
    display: grid;
    gap: 1rem;
}

.arrow-renewals-heading-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.arrow-renewals-filter-grid {
    display: grid;
    grid-template-columns: minmax(18rem, 1.4fr) repeat(4, minmax(11rem, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.arrow-renewals-filter-grid label {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.arrow-renewals-filter-grid label > span:first-child {
    color: #56657a;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.arrow-renewals-filter-grid input,
.arrow-renewals-filter-grid select {
    width: 100%;
    min-width: 0;
    height: 2.6rem;
}

.arrow-renewals-section {
    min-width: 0;
}

.arrow-renewals-table {
    min-width: 76rem;
}

.arrow-renewals-table th:nth-child(4),
.arrow-renewals-table td:nth-child(4) {
    text-align: right;
}

.arrow-renewals-plan {
    display: grid;
    gap: 0.25rem;
    min-width: 12rem;
}

.arrow-renewals-plan small {
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.35;
}

.arrow-renewals-plan-badge,
.arrow-renewals-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 1.55rem;
    padding: 0.18rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
    line-height: 1.2;
}

.arrow-renewals-plan-monthly_monthly {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.arrow-renewals-plan-annual_monthly {
    border-color: #ddd6fe;
    background: #f5f3ff;
    color: #6d28d9;
}

.arrow-renewals-plan-annual_upfront {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #047857;
}

.arrow-renewals-plan-unknown {
    border-color: #dbe3ee;
    background: #f8fafc;
    color: #475569;
}

.arrow-renewals-status-active {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #047857;
}

.arrow-renewals-status-inactive {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.arrow-renewals-row td {
    vertical-align: middle;
}

.arrow-renewals-detail-panel {
    grid-template-columns: minmax(16rem, 0.75fr) minmax(28rem, 1.25fr);
}

.arrow-renewals-detail-panel p {
    margin: 0.35rem 0 0;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.5;
}

.arrow-renewals-detail-panel code {
    color: #334155;
    font-size: 0.8rem;
}

.arrow-renewals-detail-row[hidden] {
    display: none !important;
}

@media (max-width: 1320px) {
    .arrow-renewals-filter-grid {
        grid-template-columns: repeat(3, minmax(12rem, 1fr));
    }
}

@media (max-width: 760px) {
    .arrow-renewals-heading-actions,
    .arrow-renewals-heading-actions .btn-primary,
    .arrow-renewals-heading-actions .btn-secondary {
        width: 100%;
    }

    .arrow-renewals-filter-grid {
        grid-template-columns: 1fr;
    }

    .arrow-renewals-detail-panel {
        grid-template-columns: 1fr;
    }
}

.vendor-split-group-row td {
    padding: 0.75rem 1rem !important;
    border-top: 1px solid #dbe3ee;
    border-bottom: 0;
    background: #f8fafc;
}

.vendor-split-group {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.vendor-split-group strong {
    display: block;
    color: #111827;
    font-weight: 900;
}

.vendor-split-group span,
.vendor-split-total span {
    color: #64748b;
    font-size: 0.84rem;
}

.vendor-split-total {
    text-align: right;
    white-space: nowrap;
}

.vendor-split-total strong {
    font-size: 1rem;
}

.vendor-split-part-row td {
    background: #fbfdff;
    border-top-color: #e7edf5;
}

.vendor-split-part-row td:first-child {
    border-left: 4px solid #94a3b8;
    padding-left: calc(1rem - 4px);
}

.vendor-split-part-first td {
    border-top: 1px solid #dbe3ee;
}

.vendor-split-part-last td {
    border-bottom: 2px solid #cbd5e1;
}

.vendor-split-part-row:hover td {
    background: #f5f9ff;
}

.numeric-cell {
    text-align: right;
    white-space: nowrap;
}

.payment-reminder-filters {
    align-items: end;
}

.button-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.select-col {
    width: 1%;
    white-space: nowrap;
}

.compact-checkbox {
    margin: 0;
}

.compact-input {
    min-width: 220px;
    height: 34px;
    padding: 6px 9px;
}

.vendor-manual-number-field {
    display: grid;
    gap: 0.25rem;
    min-width: 12rem;
}

.vendor-manual-number-field .compact-input {
    width: 100%;
}

.vendor-manual-number-field small {
    color: var(--color-warning-text, #7a4b00);
    font-size: 0.75rem;
}

.payment-reminder-client-row td {
    vertical-align: top;
}

.payment-reminder-client-row.is-warning td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

.payment-reminder-client-row.is-danger {
    background: #fff5f5;
}

.payment-reminder-client-row.is-danger td:first-child {
    box-shadow: inset 3px 0 0 #ef4444;
}

.payment-reminder-overdue-row.is-warning {
    background: #fff9eb;
}

.payment-reminder-overdue-row.is-danger {
    background: #fff5f5;
}

.payment-reminder-overdue-badge {
    display: inline-flex;
    min-width: 34px;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 900;
    line-height: 1.2;
}

.payment-reminder-overdue-badge.is-warning {
    border-color: #fbbf24;
    background: #fef3c7;
    color: #92400e;
}

.payment-reminder-overdue-badge.is-danger {
    border-color: #fecaca;
    background: #fee2e2;
    color: #b91c1c;
}

.payment-reminder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vendor-import-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.vendor-import-mode-toggle input {
    margin: 0;
}

.payment-reminder-detail-row > td {
    background: #f8fafc;
    padding: 0;
}

.payment-reminder-details {
    border: 0;
    border-radius: 0;
    margin: 0;
}

.payment-reminder-history {
    padding: 16px 0 0;
}

.payment-reminder-history h4 {
    margin: 0 0 8px;
    color: var(--text-color);
    font-size: 0.86rem;
    font-weight: 900;
}

.payment-reminder-email-dialog {
    width: min(1080px, calc(100vw - 32px));
}

.payment-reminder-email-subject {
    display: grid;
    gap: 4px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.payment-reminder-email-subject span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.payment-reminder-email-preview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 16px;
    padding: 18px;
}

.payment-reminder-email-frame {
    width: 100%;
    min-height: 520px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
}

.payment-reminder-email-text {
    min-height: 520px;
    max-height: 520px;
    overflow: auto;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
    font: 0.82rem/1.45 Consolas, "Courier New", monospace;
    white-space: pre-wrap;
}

@media (max-width: 920px) {
    .payment-reminder-email-preview-grid {
        grid-template-columns: 1fr;
    }
}

.action-cell {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.table-sort-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 900;
    text-transform: inherit;
    cursor: pointer;
}

.licence-id-cell,
.licence-service-cell {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.licence-id-cell strong,
.licence-service-cell strong {
    color: #111827;
    font-weight: 900;
}

.licence-id-cell span,
.licence-service-cell span {
    color: #64748b;
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.copy-licence-button,
.row-expander,
.licence-expand-inline {
    width: fit-content;
    min-height: 1.8rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.copy-licence-button {
    margin-top: 0.15rem;
}

.licence-seat-value {
    color: #111827;
    font-size: 1rem;
    font-weight: 900;
}

.licence-movement-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    min-width: 7.5rem;
}

.licence-movement-summary strong {
    min-width: 2.2rem;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.84rem;
    text-align: center;
}

.licence-movement-summary .licence-movement-up {
    background: #e9f9ef;
}

.licence-movement-summary .licence-movement-down {
    background: #fee2e2;
}

.licence-movement-summary span,
.licence-change-date span {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
}

.licence-change-date {
    min-width: 9.5rem;
}

.licence-change-date strong {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 800;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.6rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
}

.status-pill::before {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: currentColor;
}

.status-pill-active {
    color: #047857;
    background: #e9f9ef;
}

.licence-change-list {
    display: grid;
    gap: 0.45rem;
    min-width: min(22rem, 100%);
}

.licence-change-item {
    display: block;
    color: #334155;
}

.licence-event-item {
    display: grid;
    gap: 0.08rem;
    padding-left: 0.65rem;
    border-left: 3px solid #cbd5e1;
    color: #334155;
}

.licence-event-positive { border-left-color: #10b981; }
.licence-event-negative { border-left-color: #ef4444; }
.licence-event-info { border-left-color: #3b82f6; }
.licence-event-warning { border-left-color: #f59e0b; }

.licence-event-item strong {
    color: #111827;
    font-size: 0.84rem;
}

.licence-event-item span,
.licence-event-item small {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.35;
}

.licence-change-up strong {
    color: #059669;
}

.licence-change-down strong {
    color: #dc2626;
}

.licence-change-item strong {
    display: block;
    margin-bottom: 0.05rem;
    font-size: 0.84rem;
}

.licence-change-item span,
.licence-change-item small,
.licence-no-changes {
    display: block;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.35;
}

.licence-no-changes {
    padding: 0.2rem 0;
}

.licence-detail-row td {
    padding: 0 !important;
    background: #f8fafc;
}

.licence-detail-panel {
    display: grid;
    grid-template-columns: minmax(18rem, 1fr) minmax(18rem, 0.85fr);
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

.licence-detail-panel h4 {
    margin: 0 0 0.65rem;
    color: #111827;
    font-size: 0.95rem;
}

.licence-detail-panel dl {
    display: grid;
    gap: 0.45rem;
    margin: 0;
}

.licence-detail-panel dl div {
    display: grid;
    grid-template-columns: minmax(8rem, auto) 1fr;
    gap: 0.7rem;
}

.licence-detail-panel dt {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.licence-detail-panel dd {
    margin: 0;
    color: #334155;
    overflow-wrap: anywhere;
}

.licence-debug-details {
    grid-column: 1 / -1;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.75rem;
}

.licence-debug-details summary {
    cursor: pointer;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.licence-debug-details .debug-json {
    max-height: 34rem;
    white-space: pre;
}

.licence-empty-state {
    padding: 3rem 1rem !important;
    text-align: center;
}

.licence-empty-state strong,
.licence-empty-state span {
    display: block;
}

.licence-empty-state strong {
    color: #111827;
    font-size: 1rem;
}

.licence-empty-state span {
    margin-top: 0.3rem;
    color: #64748b;
}

.report-diagnostics {
    margin-top: 0;
}

.report-diagnostics summary {
    display: grid;
    gap: 0.15rem;
}

.report-diagnostics summary small {
    color: #64748b;
    font-weight: 500;
}

@media (max-width: 1400px) {
    .report-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .report-filters-header,
    .report-filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .report-filter-grid,
    .report-customer-selection-row,
    .licence-summary-grid,
    .loading-skeleton-grid,
    .licence-detail-panel {
        grid-template-columns: 1fr;
    }
}

/* Nomenclature management: AI-assisted preparation plus Horizon create form. */
.page-stack {
    display: grid;
    gap: 1rem;
}

.page-heading-row,
.section-heading,
.nom-ai-main,
.nom-create-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.section-heading {
    margin-bottom: 1rem;
}

.section-heading h3,
.section-heading p,
.nom-ai-main h4,
.nom-ai-main p {
    margin: 0;
}

.section-heading h3,
.nom-ai-main h4 {
    font-size: 1.05rem;
    line-height: 1.25;
}

.section-heading p,
.nom-ai-main p {
    margin-top: 0.25rem;
    color: #52627a;
}

.section-kicker {
    display: block;
    margin-bottom: 0.25rem;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.panel-flat {
    padding: 1rem;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    background: #fff;
}

.nom-ai-grid,
.nom-create-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 0.85rem;
}

.nom-create-grid {
    grid-template-columns: minmax(150px, 0.65fr) minmax(180px, 0.85fr) minmax(260px, 1.5fr);
}

.nom-create-grid-advanced {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.nom-ai-grid label,
.nom-create-grid label,
.nom-group-picker {
    display: grid;
    gap: 0.35rem;
}

.nom-ai-grid label > span,
.nom-create-grid label > span,
.field-label {
    color: #5f6f86;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nom-ai-grid input,
.nom-ai-grid select,
.nom-ai-grid textarea,
.nom-create-grid input,
.nom-create-grid select,
.nom-create-grid textarea {
    width: 100%;
    min-height: 38px;
    padding: 0.5rem 0.65rem;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #fff;
    color: #111827;
    font: inherit;
}

.nom-ai-grid textarea,
.nom-create-grid textarea {
    min-height: 76px;
    resize: vertical;
}

.nom-ai-grid input:focus,
.nom-ai-grid select:focus,
.nom-ai-grid textarea:focus,
.nom-create-grid input:focus,
.nom-create-grid select:focus,
.nom-create-grid textarea:focus {
    border-color: #93c5fd;
    outline: 2px solid rgba(59, 130, 246, 0.14);
    outline-offset: 0;
}

.wide-field {
    grid-column: span 2;
}

.nom-work-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.35fr);
    gap: 1rem;
    align-items: start;
}

.nom-ai-result {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #f8fbff;
}

.nom-ai-meta {
    display: grid;
    grid-template-columns: repeat(7, minmax(95px, 1fr));
    gap: 0.5rem;
}

.nom-ai-meta-item {
    display: grid;
    gap: 0.2rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.nom-ai-meta-item span {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nom-ai-meta-item strong {
    overflow-wrap: anywhere;
}

.nom-ai-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.compact-list {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.tag-button {
    padding: 0.25rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.tag-button:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.inline-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
}

.nom-group-picker {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.nom-group-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nom-group-picker-header strong {
    display: block;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}

.nom-group-results {
    display: grid;
    gap: 0.4rem;
    max-height: 260px;
    margin-top: 0.35rem;
    overflow: auto;
}

.nom-group-result {
    display: grid;
    gap: 0.15rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    text-align: left;
}

.nom-group-result:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}

.nom-group-result.is-selected {
    border-color: #ef4444;
    background: #fff5f5;
}

.nom-group-result span {
    color: #64748b;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.nom-advanced-fields {
    margin-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

.nom-advanced-fields summary {
    padding: 0.75rem 0 0;
    color: #52627a;
    cursor: pointer;
    font-weight: 800;
}

.nom-advanced-fields[open] summary {
    margin-bottom: 0.75rem;
}

.nom-create-footer {
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 1300px) {
    .nom-work-grid,
    .nom-ai-columns {
        grid-template-columns: 1fr;
    }

    .nom-ai-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .page-heading-row,
    .section-heading,
    .nom-ai-main,
    .nom-create-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .nom-ai-grid,
    .nom-create-grid,
    .nom-ai-meta {
        grid-template-columns: 1fr;
    }

    .wide-field {
        grid-column: span 1;
    }
}

.file-management-page {
    display: grid;
    gap: 18px;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.page-header-row > div {
    min-width: 0;
}

.page-header-row .section-kicker {
    margin: 0 0 0.35rem;
}

.page-header-row .page-title {
    margin: 0;
}

.page-header-row .page-description {
    margin: 0.2rem 0 0 !important;
    max-width: min(760px, 100%) !important;
    line-height: 1.45 !important;
}

.file-management-card {
    display: grid;
    gap: 16px;
}

.file-management-tabs {
    overflow-x: auto;
    white-space: nowrap;
}

.file-management-filters {
    align-items: end;
}

.file-management-table td {
    vertical-align: middle;
}

.file-management-document-row[data-expanded="1"] td {
    background: #f8fafc !important;
    box-shadow: none !important;
}

.file-management-select-cell {
    width: 42px;
    text-align: center;
}

.file-management-select-cell input {
    width: 16px;
    height: 16px;
}

.file-management-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.file-management-detail-row > td {
    padding: 0;
    background: #f8fafc;
    border-top: 0;
}

.file-management-inline-attachments {
    display: grid;
    gap: 12px;
    padding: 16px 18px 18px;
    border-top: 1px solid var(--border-color, #dfe3ea);
    border-bottom: 1px solid var(--border-color, #dfe3ea);
}

.file-management-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.file-management-inline-header > div {
    display: grid;
    gap: 3px;
}

.file-attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-preview-open {
    overflow: hidden;
}

.file-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.72);
}

.file-preview-modal[hidden] {
    display: none;
}

.file-preview-dialog {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 12px;
    width: min(1180px, 96vw);
    height: min(860px, 92vh);
    padding: 18px;
    border-radius: 8px;
    background: #fff;
}

.file-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.file-preview-header h3,
.file-preview-header p {
    margin: 0;
}

.file-preview-content {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border-color, #dfe3ea);
    background: #f8fafc;
}

.file-preview-frame {
    width: 100%;
    height: 100%;
    min-height: 620px;
    border: 0;
    background: #fff;
}

.file-preview-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    object-fit: contain;
}

.panel-card {
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.metric-card {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #fff;
}

.metric-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin-top: 4px;
    color: var(--text-color);
    font-size: 1.45rem;
}

.filter-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.accounting-month-picker {
    position: relative;
    min-width: 0;
}

.accounting-checklist-filters {
    grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
}

.accounting-month-picker-main {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: stretch;
}

.accounting-month-picker-main .btn-small {
    min-width: 38px;
    padding-right: 0;
    padding-left: 0;
    font-size: 1.25rem;
    line-height: 1;
}

.accounting-month-toggle {
    display: flex;
    min-width: 0;
    min-height: 42px;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding: 0.48rem 0.78rem;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #fff;
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.accounting-month-toggle:hover,
.accounting-month-toggle:focus-visible {
    border-color: var(--primary-color);
    background: #fffafa;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.08);
    outline: none;
}

.accounting-month-toggle strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.98rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.accounting-month-toggle span {
    max-width: 100%;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.accounting-month-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    width: min(360px, calc(100vw - 40px));
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.accounting-month-panel-header {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.accounting-month-panel-header strong {
    text-align: center;
    font-size: 1rem;
}

.accounting-month-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.accounting-month-option {
    min-height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #fff;
    color: var(--text-color);
    cursor: pointer;
    font-weight: 700;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.accounting-month-option:hover,
.accounting-month-option:focus-visible {
    border-color: var(--primary-color);
    background: #fffafa;
    outline: none;
}

.accounting-month-option.is-current {
    border-style: dashed;
    color: var(--primary-color);
}

.accounting-month-option.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

.accounting-month-shortcuts {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.accounting-checklist-sections {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.accounting-checklist-section {
    display: grid;
    gap: 14px;
}

.accounting-checklist-section .section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.accounting-checklist-section h3,
.accounting-checklist-section p {
    margin: 0;
}

.accounting-checklist-samples {
    margin-top: 8px;
}

.accounting-checklist-samples summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 700;
}

.accounting-manual-list {
    display: grid;
    gap: 10px;
}

.accounting-manual-item {
    display: grid;
    grid-template-columns: minmax(260px, 1.1fr) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}

.accounting-manual-item:first-child {
    border-top: 0;
}

.accounting-manual-item input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

@media (max-width: 900px) {
    .auth-admin-header {
        align-items: stretch;
        flex-direction: column;
    }

    .auth-add-user-form,
    .auth-password-form,
    #auth-change-modules-form {
        grid-template-columns: 1fr;
    }

    .accounting-month-picker {
        min-width: 0;
    }

    .accounting-checklist-section .section-heading-row,
    .accounting-manual-item {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}

@media (max-width: 900px) {
    .file-management-inline-header {
        align-items: stretch;
        flex-direction: column;
    }

    .file-preview-modal {
        padding: 8px;
    }

    .file-preview-dialog {
        width: 100%;
        height: 96vh;
        padding: 12px;
    }
}

/* UX polish: quieter app chrome, clearer controls, and tighter operations workflows. */
.ui-icon {
    width: 1rem;
    height: 1rem;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-topbar {
    justify-content: flex-end !important;
}

.topbar-actions {
    margin-left: auto;
}

.icon-button {
    text-decoration: none;
}

.topbar-alert-link .ui-icon {
    width: 1.05rem;
    height: 1.05rem;
}

.sidebar-link-icon {
    flex: 0 0 auto;
}

.sidebar-link-icon .ui-icon {
    width: 0.98rem;
    height: 0.98rem;
}

.card-accent,
.card-muted,
.dashboard-hero-card,
.tracking-dashboard-hero,
.settings-sidebar-card {
    border-style: solid !important;
    background: #ffffff !important;
    background-image: none !important;
}

.card-header,
.documents-card-header {
    padding-bottom: 0.75rem !important;
    border-bottom-color: #e5e7eb !important;
}

.documents-card-header {
    background: transparent !important;
}

.filters-grid,
.page-toolbar,
.documents-filters-grid,
.workspace-form-main {
    align-items: end !important;
}

.documents-filters-grid {
    grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) minmax(220px, 0.9fr) minmax(150px, 0.7fr) !important;
    gap: 0.75rem !important;
}

.documents-filter-action .btn-primary,
.workspace-form-main .btn-primary,
.workspace-form-main .btn-secondary,
.page-toolbar .btn-primary,
.page-toolbar .btn-secondary {
    min-height: 42px;
    white-space: nowrap;
}

.checkbox-cell {
    min-height: 42px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 0.55rem !important;
    width: 100%;
    padding: 0.55rem 0.7rem !important;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155 !important;
    line-height: 1.25;
}

.checkbox-cell:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.checkbox-cell:has(input:checked) {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b91c1c !important;
}

.checkbox-cell input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1rem !important;
    height: 1rem !important;
}

.checkbox-cell span {
    min-width: 0;
}

.documents-filter-checkbox,
.filters-grid label.checkbox-cell,
.unpaid-filters label.checkbox-cell {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.documents-filter-checkbox > span,
.filters-grid label.checkbox-cell > span,
.unpaid-filters label.checkbox-cell > span {
    display: inline !important;
}

.workspace-form-main {
    grid-template-columns: minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(190px, 0.95fr) minmax(150px, 0.7fr) minmax(220px, 1fr) minmax(170px, 0.75fr) !important;
    padding: 0.85rem !important;
}

.workspace-advanced {
    border-color: #e5e7eb !important;
    border-radius: 8px;
    background: #f8fafc !important;
}

.workspace-summary-bar {
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding-top: 0.15rem !important;
}

.workspace-summary-bar .summary-inline {
    margin-right: auto !important;
}

.workspace-confirm-inline {
    width: auto;
    min-width: 180px;
}

.page-toolbar {
    grid-template-columns: minmax(180px, 0.5fr) minmax(180px, 0.5fr) auto auto !important;
    justify-content: start;
    padding: 0.85rem !important;
}

.tracking-dashboard-hero {
    padding: 1rem !important;
}

.tracking-dashboard-sync-strip {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem !important;
}

.tracking-summary-grid {
    gap: 0.85rem !important;
}

.settings-sidebar-card {
    display: none !important;
}

.settings-sidebar {
    top: 0.75rem;
}

.settings-tab-group {
    padding: 0.8rem !important;
    background: #ffffff !important;
}

.settings-tab-group .tab-bar {
    gap: 0.65rem !important;
    margin-bottom: 0 !important;
}

.settings-tab-bar .tab-button {
    min-height: 1.9rem !important;
    padding: 0.25rem 0 0.35rem !important;
}

.auth-admin-card {
    gap: 0.9rem !important;
}

.auth-settings-section {
    border-radius: 8px !important;
    background: #f8fafc !important;
}

.auth-add-user-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
}

.auth-add-modules-field {
    grid-column: 1 / -1;
}

.auth-add-user-form .button-cell {
    grid-column: 1 / -1;
}

.auth-add-user-form .button-cell .btn-primary {
    width: auto;
    min-width: 180px;
}

.auth-password-form {
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto !important;
}

.auth-module-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
}

.auth-module-card {
    min-height: 58px !important;
    padding: 0.7rem !important;
}

.auth-module-card-copy small {
    line-height: 1.35;
}

@media (max-width: 1280px) {
    .documents-filters-grid,
    .workspace-form-main,
    .page-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .documents-filter-action,
    .workspace-form-main .button-cell,
    .page-toolbar .button-cell {
        align-self: end;
    }
}

@media (max-width: 980px) {
    .tracking-dashboard-sync-strip,
    .auth-password-form {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 760px) {
    .documents-filters-grid,
    .workspace-form-main,
    .page-toolbar,
    .auth-add-user-form {
        grid-template-columns: 1fr !important;
    }

    .workspace-confirm-inline {
        width: 100%;
    }
}

/* 2026 visual-system pass: one calm, high-clarity operations workspace. */
:root {
    --primary-color: #e2342a;
    --primary-dark: #c9251d;
    --primary-rgb: 226, 52, 42;
    --background-color: #f6f7f9;
    --card-background: #ffffff;
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-main: #172033;
    --text-muted: #64748b;
    --surface-muted: #f8fafc;
    --radius: 10px;
}

html,
body,
.app-layout,
.app-main-shell,
.page-content {
    background: var(--background-color) !important;
}

body {
    line-height: 1.5;
}

.app-layout {
    grid-template-columns: 248px minmax(0, 1fr);
}

.app-sidebar {
    gap: 1.25rem;
    padding: 1.35rem 0.9rem 1rem;
    border-right-color: #e5eaf0 !important;
    background: #ffffff !important;
}

.app-brand {
    min-height: 3.2rem;
    padding: 0 0.65rem;
}

.app-brand-mark {
    font-size: 1.1rem;
    letter-spacing: 0.14em;
}

.app-brand-sub {
    margin-left: auto;
    padding: 0.18rem 0.38rem;
    border: 1px solid #e5eaf0;
    border-radius: 4px;
    color: #64748b !important;
    font-size: 0.61rem;
    letter-spacing: 0.08em;
}

.sidebar-group {
    gap: 0.16rem;
    margin-bottom: 1.05rem;
}

.sidebar-group-label {
    margin: 0.25rem 0 0.38rem;
    padding: 0 0.65rem;
    font-size: 0.64rem;
    letter-spacing: 0.1em;
}

.sidebar-link {
    min-height: 2.55rem;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 650;
}

.sidebar-link:hover {
    border-color: transparent !important;
    background: #f4f6f8 !important;
}

.sidebar-link.active {
    border-color: #fde1df !important;
    background: #fff4f3 !important;
    box-shadow: inset 2px 0 0 var(--primary-color) !important;
}

.sidebar-link-icon,
.sidebar-link.active .sidebar-link-icon {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 4px;
    background: transparent !important;
}

.sidebar-footer {
    padding: 0.65rem;
    border-top: 1px solid #edf0f4;
    font-size: 0.7rem;
}

.app-topbar {
    min-height: 68px;
    padding: 0.75rem 2.5rem;
    border-bottom-color: #e5eaf0 !important;
    background: rgba(255, 255, 255, 0.94) !important;
}

.topbar-actions {
    gap: 0.5rem;
}

.icon-button {
    width: 2.3rem;
    height: 2.3rem;
    border-color: transparent !important;
    background: transparent !important;
}

.icon-button:hover {
    border-color: #e5eaf0 !important;
    background: #f8fafc !important;
}

.topbar-user {
    padding: 0.28rem 0.2rem 0.28rem 0.45rem;
    border-color: transparent !important;
    background: transparent !important;
}

.topbar-user:hover {
    background: #f8fafc !important;
}

.user-avatar {
    width: 2.05rem;
    height: 2.05rem;
    background: #fff0ef;
    color: var(--primary-dark);
}

.topbar-logout {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
}

.topbar-logout:hover {
    color: var(--primary-dark);
    background: #fff4f3;
}

.page-content {
    padding: 2rem 2.5rem 2.75rem;
}

.page-content > section {
    gap: 1.25rem;
}

.page-title {
    font-size: clamp(1.55rem, 1.8vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.025em;
}

.page-description,
.page-heading-row .page-description {
    color: #64748b !important;
    font-size: 0.92rem;
    line-height: 1.55 !important;
}

.card,
.stat-card,
.documents-card,
.documents-results-card,
.table-responsive,
.data-table-shell,
.documents-table-shell,
.filters-grid,
.page-toolbar,
.unpaid-filters,
.client-registry-filters,
.subscription-filters {
    border-color: #e2e8f0 !important;
    border-radius: var(--radius) !important;
}

.card,
.documents-card,
.documents-results-card {
    padding: 1.25rem;
}

.card:hover,
.stat-card:hover {
    border-color: #d6dee8 !important;
    transform: none !important;
}

.card-header {
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom-color: #edf0f4;
}

.card-header h3,
.section-header h3 {
    font-size: 1.05rem;
    font-weight: 720;
}

.stat-card {
    min-height: 7.2rem;
    padding: 1rem 1.1rem;
    border-left: 3px solid #f7b4af !important;
    border-top: 1px solid #e2e8f0 !important;
}

.stat-card h3 {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.075em;
}

.stat-value {
    margin-top: 0.1rem;
    font-size: 1.65rem;
    font-weight: 760;
    letter-spacing: -0.03em;
}

.filters-grid,
.page-toolbar,
.unpaid-filters,
.documents-filters-grid,
.client-registry-filters,
.subscription-filters {
    gap: 0.85rem !important;
    padding: 1rem !important;
    background: #fbfcfd !important;
}

.filters-grid label > span,
.filters-grid .field-group > span,
.filters-grid .module-label {
    color: #64748b;
    font-size: 0.68rem;
    letter-spacing: 0.07em;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.client-registry-input,
.subscription-filters input[type="search"],
.client-registry-filters input,
.client-registry-filters select {
    min-height: 2.5rem;
    border-radius: 7px !important;
    color: #1e293b;
}

input:focus,
select:focus,
textarea:focus,
.client-registry-input:focus {
    border-color: #f09b94 !important;
    outline: 3px solid rgba(var(--primary-rgb), 0.1) !important;
}

.btn-primary,
.btn-secondary,
.btn-small {
    min-height: 2.5rem;
    border-radius: 7px !important;
    font-weight: 700;
}

.btn-primary {
    width: auto;
    padding: 0.62rem 1rem;
    background: var(--primary-color) !important;
}

.button-cell .btn-primary,
.button-cell .btn-secondary {
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
}

.btn-secondary,
.btn-small {
    padding: 0.55rem 0.85rem;
    border-color: #dbe3ee !important;
    color: #334155 !important;
}

.tab-bar {
    gap: 1.1rem;
    padding: 0;
    border: 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

.tab-button {
    position: relative;
    padding: 0.5rem 0 0.65rem;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 0.88rem;
}

.tab-button::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--primary-color);
    content: '';
    opacity: 0;
    transform: scaleX(0.65);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.tab-button:hover,
.tab-button.active {
    color: var(--primary-dark) !important;
}

.tab-button.active {
    box-shadow: none !important;
}

.tab-button.active::after {
    opacity: 1;
    transform: scaleX(1);
}

.settings-tab-bar .tab-button {
    padding: 0.45rem 0.2rem;
}

.settings-tab-bar .tab-button::after {
    right: auto;
    width: 2px;
    height: auto;
    top: 0;
    bottom: 0;
    transform: scaleY(0.65);
}

.settings-tab-bar .tab-button.active::after {
    transform: scaleY(1);
}

.data-table th,
table th,
.documents-table-shell thead th {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    background: #f8fafc !important;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.065em;
}

.data-table td,
table td {
    border-color: #edf0f4 !important;
}

@media (max-width: 980px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 1.5rem 1.25rem 2.25rem;
    }

    .app-topbar {
        padding: 0.7rem 1.25rem;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 1.25rem 1rem 2rem;
    }

    .app-topbar {
        min-height: 58px;
        padding: 0.55rem 0.8rem;
    }

    .topbar-user small,
    .topbar-logout {
        display: none;
    }

    .card,
    .documents-card,
    .documents-results-card {
        padding: 1rem;
    }

    .tab-bar {
        gap: 0.85rem;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab-button {
        white-space: nowrap;
    }
}

/* Productivity layer: action priorities, persistent filters, tables, and quick navigation. */
.dashboard-action-center {
    display: grid;
    gap: 0.85rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    background: #ffffff;
}

.dashboard-action-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-action-header h3 {
    margin: 0.1rem 0 0;
    color: #172033;
    font-size: 1.02rem;
}

.dashboard-action-count {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
}

.dashboard-action-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
}

.dashboard-action-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    min-height: 4.6rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #e5eaf0;
    border-left: 3px solid #cbd5e1;
    border-radius: 8px;
    color: #172033;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dashboard-action-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.dashboard-action-item.is-urgent {
    border-left-color: var(--primary-color);
}

.dashboard-action-item-copy {
    display: grid;
    gap: 0.18rem;
}

.dashboard-action-item-copy strong {
    font-size: 0.86rem;
}

.dashboard-action-item-copy small {
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.4;
}

.app-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 8.5rem;
    padding: 1.25rem;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #fbfcfd;
    color: #475569;
    text-align: left;
}

.app-state.is-compact {
    justify-content: flex-start;
    min-height: 0;
    padding: 0.85rem;
}

.app-state-mark {
    display: inline-grid;
    flex: 0 0 auto;
    width: 1.9rem;
    height: 1.9rem;
    place-items: center;
    border-radius: 999px;
    background: #ecfdf5;
    color: #15803d;
    font-weight: 800;
}

.app-state strong,
.app-state p {
    margin: 0;
}

.app-state p {
    margin-top: 0.15rem;
    color: #64748b;
    font-size: 0.82rem;
}

.app-table-state-cell,
.app-empty-state-inline {
    padding: 1.25rem !important;
    color: #64748b !important;
    font-size: 0.84rem;
    font-weight: 600;
    text-align: center;
}

.app-table-state-cell::before,
.app-empty-state-inline::before {
    display: inline-grid;
    width: 1.35rem;
    height: 1.35rem;
    margin-right: 0.45rem;
    place-items: center;
    border-radius: 999px;
    background: #eef2f7;
    color: #64748b;
    content: 'i';
    font-size: 0.72rem;
    font-weight: 800;
}

.filter-persistence-note {
    grid-column: 1 / -1;
    margin: -0.15rem 0 0;
    color: #94a3b8;
    font-size: 0.72rem;
}

.cache-freshness-wrap {
    display: grid;
    gap: 0.85rem;
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    background: #fbfcfd;
}

.cache-freshness-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.cache-freshness-header h4 {
    margin: 0.1rem 0 0;
    color: #172033;
    font-size: 1rem;
}

.cache-freshness-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 0.65rem;
}

.cache-freshness-card {
    display: grid;
    gap: 0.3rem;
    min-height: 6.7rem;
    padding: 0.8rem;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
}

.cache-freshness-card.is-fresh {
    border-left-color: #22c55e;
}

.cache-freshness-card.is-stale {
    border-left-color: #f59e0b;
}

.cache-freshness-card.is-error {
    border-left-color: var(--primary-color);
}

.cache-freshness-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cache-freshness-card strong {
    color: #172033;
    font-size: 0.82rem;
}

.cache-freshness-card p,
.cache-freshness-card small {
    margin: 0;
    color: #64748b;
    font-size: 0.75rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.status-pill.is-fresh {
    background: #ecfdf5;
    color: #15803d;
}

.status-pill.is-stale {
    background: #fffbeb;
    color: #a16207;
}

.status-pill.is-error {
    background: #fff1f2;
    color: #be123c;
}

.table-productivity-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #fbfcfd;
}

.table-productivity-bar + table {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.table-productivity-label {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.table-productivity-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.table-column-picker {
    position: relative;
}

.table-column-picker summary {
    cursor: pointer;
    padding: 0.42rem 0.65rem;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
    list-style: none;
}

.table-column-picker summary::-webkit-details-marker {
    display: none;
}

.table-column-picker-list {
    position: absolute;
    z-index: 12;
    top: calc(100% + 0.35rem);
    right: 0;
    display: grid;
    min-width: 13rem;
    max-height: 18rem;
    gap: 0.35rem;
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.table-column-picker-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    font-size: 0.78rem;
}

.table-column-hidden {
    display: none !important;
}

.command-palette-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.35rem 0.45rem 0.35rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #ffffff;
    color: #64748b;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.command-palette-trigger:hover {
    border-color: #cbd5e1;
    color: #172033;
}

.command-palette-trigger kbd {
    padding: 0.15rem 0.3rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f8fafc;
    color: #64748b;
    font-family: var(--app-monospace-family);
    font-size: 0.65rem;
}

.command-palette[hidden] {
    display: none;
}

.command-palette,
.command-palette-backdrop {
    position: fixed;
    z-index: 100;
    inset: 0;
}

.command-palette-backdrop {
    background: rgba(15, 23, 42, 0.34);
}

.command-palette-dialog {
    position: relative;
    z-index: 1;
    width: min(38rem, calc(100vw - 2rem));
    max-height: min(32rem, calc(100vh - 3rem));
    margin: 12vh auto 0;
    overflow: auto;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.command-palette-dialog > label {
    display: block;
    padding: 0.75rem;
    border-bottom: 1px solid #e5eaf0;
}

.command-palette-dialog input {
    width: 100%;
    min-height: 2.7rem;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 7px;
    background: #f8fafc;
    color: #172033;
    font: inherit;
    outline: 0;
}

.command-palette-dialog input:focus {
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #f09b94, 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.command-palette-results {
    display: grid;
    gap: 0.2rem;
    padding: 0.55rem;
}

.command-palette-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.72rem 0.8rem;
    border-radius: 7px;
    color: #172033;
    font-size: 0.88rem;
}

.command-palette-item:hover,
.command-palette-item.is-active {
    background: #fff4f3;
    color: var(--primary-dark);
}

.command-palette-item small {
    color: #94a3b8;
    font-size: 0.7rem;
}

.command-palette-dialog > p {
    margin: 0;
    padding: 0.6rem 0.9rem;
    border-top: 1px solid #e5eaf0;
    color: #94a3b8;
    font-size: 0.72rem;
}

.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;
}

@media (max-width: 640px) {
    .command-palette-trigger span,
    .command-palette-trigger kbd {
        display: none;
    }

    .command-palette-trigger::before {
        content: '⌘';
        font-weight: 800;
    }

    .dashboard-action-header,
    .cache-freshness-header,
    .table-productivity-bar {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Client registry licence snapshots. */
.clients-page #clients-registry-panel .page-toolbar {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 0.8fr)) auto;
}

.clients-page #clients-list-table-body td:last-child {
    min-width: 290px;
}

.client-license-summary {
    display: grid;
    gap: 0.42rem;
    margin-bottom: 0.4rem;
}

.client-license-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    line-height: 1.35;
}

.client-license-summary-row > span:first-child {
    min-width: 0;
}

.client-license-sync {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.32rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.client-license-sync::before {
    width: 0.46rem;
    height: 0.46rem;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.client-license-sync.is-success { color: var(--success); }
.client-license-sync.is-warning { color: var(--warning); }
.client-license-sync.is-danger { color: var(--danger); }
.client-license-sync.is-neutral { color: var(--text-muted); }

.client-license-section {
    display: grid;
    gap: 0.75rem;
    padding: 0.9rem;
    border: 1px solid var(--border-color);
    background: #fff;
}

.client-license-section-header h4,
.client-license-section-header p {
    margin: 0;
}

.client-license-section-header h4 {
    font-size: 0.98rem;
}

.client-license-section-header p {
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.client-license-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.client-license-grid > .empty-state-inline {
    grid-column: 1 / -1;
    margin: 0;
}

.client-license-card {
    display: grid;
    align-content: start;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.client-license-card-header,
.client-license-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.client-license-card-header h5 {
    margin: 0;
    font-size: 0.95rem;
}

.client-license-primary {
    display: grid;
    gap: 0.12rem;
}

.client-license-primary strong {
    font-size: 1.4rem;
    line-height: 1.1;
}

.client-license-primary span,
.client-license-card-footer,
.client-license-error {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.client-license-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 0.55rem;
    margin: 0;
}

.client-license-metrics div {
    display: grid;
    gap: 0.1rem;
}

.client-license-metrics dt {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.client-license-metrics dd {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
}

.client-license-error {
    margin: 0;
    padding: 0.5rem 0.6rem;
    border-left: 3px solid var(--warning);
    background: #fff7ed;
    color: #9a4d14;
}

.client-license-card-footer {
    align-items: flex-end;
    padding-top: 0.55rem;
    border-top: 1px solid #e2e8f0;
}

.client-license-card-footer span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.client-license-card-footer a {
    flex: 0 0 auto;
    font-weight: 700;
}

@media (max-width: 760px) {
    .client-license-grid {
        grid-template-columns: 1fr;
    }

    .client-license-summary-row,
    .client-license-card-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }
}
.client-tech-services,
.client-editor-section {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color, #d9dde3);
    border-radius: 8px;
}

.client-tech-services legend,
.client-editor-section legend {
    padding: 0 0.35rem;
    font-weight: 700;
}

.client-tech-service-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
    margin-top: 0.65rem;
}

.client-tech-services-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.client-vendor-catalog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.client-vendor-catalog-heading .metric-sub {
    margin: 0;
}

.client-tech-service-list {
    display: grid;
    gap: 0.5rem;
}

.client-tech-service-row {
    display: grid;
    grid-template-columns: minmax(145px, 0.7fr) minmax(240px, 1.6fr) minmax(150px, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-top: 1px solid #e5e7eb;
}

.client-tech-service-row select {
    width: 100%;
}

.client-tech-service-row.is-pending {
    opacity: 0.72;
}

@media (max-width: 900px) {
    .client-vendor-catalog-heading,
    .client-tech-services-heading,
    .client-tech-service-row {
        display: flex;
        align-items: stretch;
        flex-direction: column;
    }
}

/* Client registry master-detail workspace. */
.clients-page #clients-registry-panel {
    gap: 0.85rem;
}

.clients-workspace {
    display: grid;
    grid-template-columns: minmax(480px, 0.92fr) minmax(540px, 1.08fr);
    gap: 0.9rem;
    height: clamp(620px, calc(100vh - 300px), 880px);
    min-height: 0;
}

.clients-workspace > .card,
.clients-workspace > .card + .card {
    min-width: 0;
    height: 100%;
    margin-top: 0;
    padding: 0;
    overflow: hidden;
    border-color: var(--border-color);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: none;
}

.clients-list-card,
.clients-editor-card {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.clients-list-card > .card-header,
.clients-editor-card > .card-header {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
}

.clients-list-card > .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    overflow: auto;
}

.clients-list-card .data-table {
    min-width: 620px;
}

.clients-list-card .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.clients-list-card .data-table th,
.clients-list-card .data-table td {
    padding: 0.68rem 0.72rem;
}

.clients-list-card .client-registry-row {
    cursor: pointer;
}

.clients-list-card .client-registry-row.selected-row td {
    background: #fff5f3 !important;
}

.clients-list-card .client-registry-row.selected-row td:first-child {
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.clients-page #clients-list-table-body td:last-child {
    min-width: 165px;
}

.client-registry-service-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.clients-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.client-editor-close {
    display: none;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
}

.client-editor-form {
    display: flex;
    flex: 1 1 auto;
    height: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.client-editor-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 1.25rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    background: #fff;
}

.client-editor-tab {
    position: relative;
    flex: 0 0 auto;
    padding: 0.78rem 0 0.7rem;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 750;
    cursor: pointer;
}

.client-editor-tab::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: transparent;
    content: "";
}

.client-editor-tab.active {
    color: var(--text-main);
}

.client-editor-tab.active::after {
    background: var(--primary-color);
}

.client-editor-scroll {
    flex: 1 1 auto;
    height: 0;
    min-height: 0;
    padding: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    scrollbar-gutter: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-y;
}

.client-editor-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.client-editor-tab-panel {
    display: grid;
    align-content: start;
    gap: 0.85rem;
}

.client-editor-tab-panel[hidden] {
    display: none;
}

.client-editor-tab-panel .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-editor-tab-panel .client-editor-section,
.client-editor-tab-panel .client-tech-services {
    margin: 0;
    border-radius: var(--radius);
}

.client-editor-notes-field {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 0.45rem;
}

.client-editor-notes-field > span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 750;
}

.client-editor-notes-field textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 7rem;
    max-height: 18rem;
    padding: 0.75rem 0.85rem;
    box-sizing: border-box;
    line-height: 1.45;
    resize: vertical;
}

.client-horizon-combobox {
    z-index: 6;
}

.client-horizon-combobox .report-client-suggestions {
    max-height: min(20rem, 48vh);
}

.client-horizon-combobox .report-client-suggestion strong {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.client-horizon-combobox .report-client-suggestion .status-pill {
    flex: 0 0 auto;
    color: inherit;
    font-size: 0.7rem;
}

.client-editor-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

.client-editor-actions .btn-primary {
    min-width: 155px;
}

/* Compact operational client overview. */
.client-overview-modal-card {
    width: min(1180px, 96vw);
    max-height: min(92vh, 1040px);
}

.client-overview-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    background: #fff;
}

.client-overview-stat {
    display: grid;
    align-content: start;
    min-width: 0;
    padding: 0.85rem 1rem;
    border-right: 1px solid var(--border-color);
}

.client-overview-stat:last-child {
    border-right: 0;
}

.client-overview-stat-label,
.client-overview-stat > span,
.client-overview-stat > a {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.client-overview-stat > strong {
    margin: 0.18rem 0;
    color: var(--text-main);
    font-size: 1.35rem;
    line-height: 1.15;
}

.client-overview-content {
    display: grid;
    gap: 0.9rem;
}

.client-overview-section {
    min-width: 0;
    padding: 0.95rem;
    border: 1px solid var(--border-color);
    background: #fff;
}

.client-overview-section-header,
.client-overview-service-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.client-overview-section-header {
    margin-bottom: 0.75rem;
}

.client-overview-section-header h4,
.client-overview-section-header p,
.client-overview-service-card p {
    margin: 0;
}

.client-overview-section-header h4 {
    font-size: 0.96rem;
}

.client-overview-section-header p,
.client-overview-service-card p,
.client-overview-service-card > span {
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.client-overview-service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.client-overview-service-grid > .empty-state-inline {
    grid-column: 1 / -1;
    margin: 0;
}

.client-overview-service-card {
    display: grid;
    align-content: start;
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #94a3b8;
    background: #f8fafc;
}

.client-overview-service-card.has-attention {
    border-left-color: var(--danger);
    background: #fffafa;
}

.client-overview-service-id {
    overflow-wrap: anywhere;
}

.client-overview-anomalies {
    margin-top: 0.75rem;
    padding: 0.7rem 0.8rem;
    border-left: 3px solid var(--danger);
    background: #fff7f7;
    color: #8f2727;
    font-size: 0.79rem;
}

.client-overview-anomalies ul {
    margin: 0.35rem 0 0;
    padding-left: 1.15rem;
}

.client-overview-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 0.9rem;
}

.client-overview-table {
    font-size: 0.8rem;
}

.client-overview-link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.client-overview-link-pill {
    display: inline-flex;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.38rem 0.55rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.client-overview-link-pill strong {
    color: var(--text-main);
}

.client-overview-links-section #client-card-notes:not(:empty) {
    margin: 0.7rem 0 0;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 900px) {
    .client-overview-summary-grid,
    .client-overview-service-grid,
    .client-overview-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .client-overview-stat:nth-child(2) {
        border-right: 0;
    }

    .client-overview-stat:nth-child(-n + 2) {
        border-bottom: 1px solid var(--border-color);
    }

    .client-overview-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .client-overview-summary-grid,
    .client-overview-service-grid {
        grid-template-columns: 1fr;
    }

    .client-overview-stat,
    .client-overview-stat:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .client-overview-stat:last-child {
        border-bottom: 0;
    }
}

.clients-editor-card > .client-detail-panel {
    display: none !important;
}

@media (max-width: 1180px) {
    .clients-page #clients-registry-panel .page-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .clients-page #clients-registry-panel .page-toolbar .button-cell {
        grid-column: 1 / -1;
    }

    .clients-workspace {
        display: block;
        height: clamp(560px, calc(100vh - 320px), 820px);
    }

    .clients-list-card {
        height: 100%;
    }

    .clients-editor-card {
        position: fixed;
        z-index: 1300;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(680px, 100vw);
        height: 100vh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        transform: translateX(102%);
        transition: transform 0.2s ease;
    }

    .clients-editor-card.is-mobile-open {
        transform: translateX(0);
    }

    .client-editor-close {
        display: inline-flex;
    }
}

@media (max-width: 700px) {
    .clients-page #clients-registry-panel .page-toolbar,
    .client-editor-tab-panel .filters-grid {
        grid-template-columns: 1fr;
    }

    .clients-list-card .data-table {
        min-width: 560px;
    }

    .client-editor-scroll {
        padding: 0.8rem;
    }

    .client-editor-actions .btn-primary,
    .client-editor-actions .btn-secondary {
        width: auto;
    }
}

.tech-client-row {
    cursor: pointer;
}

.tech-client-row:hover {
    background: #f8fafc;
}

.tech-client-detail > td {
    padding: 0.75rem 1rem 1rem;
    background: #f8fafc;
}

.tech-device-table-wrap {
    overscroll-behavior-x: contain;
}

.tech-device-table thead th {
    border-bottom: 2px solid #cbd5e1;
    background: #f8fafc !important;
}

.tech-service-cell {
    min-width: 195px;
    vertical-align: top;
}

.tech-service-cell-label {
    display: block;
    margin: -0.15rem 0 0.42rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.67rem;
    font-weight: 850;
    letter-spacing: 0.055em;
    line-height: 1.2;
    text-transform: uppercase;
}

.tech-service-column-header {
    min-width: 195px;
}

.tech-device-aliases {
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    margin-top: 0.5rem;
    padding: 0.42rem 0.5rem;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 0.45rem;
    background: rgba(37, 99, 235, 0.045);
    color: #334155;
    font-size: 0.75rem;
    line-height: 1.4;
}

.tech-device-aliases > .status-pill {
    flex: 0 0 auto;
}

.tech-device-alias {
    display: block;
}

.tech-device-alias + .tech-device-alias {
    margin-top: 0.16rem;
}

.tech-device-alias span {
    color: #64748b;
}

.backup-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.backup-view-tabs {
    display: flex;
    gap: 1.2rem;
    margin-top: 1.2rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
}

.backup-view-tab {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    padding: 0.65rem 0.05rem 0.55rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #64748b;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}

.backup-view-tab:hover {
    color: #172033;
}

.backup-view-tab.is-active {
    border-bottom-color: var(--primary);
    color: #172033;
}

.backup-view-tab span {
    min-width: 1.35rem;
    padding: 0.08rem 0.32rem;
    border-radius: 999px;
    background: #eef2f6;
    color: #475569;
    font-size: 0.65rem;
    text-align: center;
}

.backup-message-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.backup-latest-message-action {
    margin-top: 7px;
}

.backup-message-delete {
    color: #b42318;
    border-color: #f0b4ae;
}

.backup-message-delete:hover {
    color: #8f1710;
    border-color: #dc8279;
    background: #fff5f4;
}

.backup-device-section-header {
    display: flex;
    gap: 1rem;
    align-items: end;
    justify-content: space-between;
    margin: 1.4rem 0 0.65rem;
}

.backup-device-section-header h3,
.backup-device-section-header p {
    margin: 0;
}

.backup-device-section-header h3 {
    color: var(--text-main);
    font-size: 1rem;
}

.backup-device-section-header > div p {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.backup-device-row {
    cursor: pointer;
}

.backup-device-row:hover {
    background: #f8fafc;
}

.backup-device-row:focus-visible {
    outline: 2px solid #64748b;
    outline-offset: -2px;
}

.backup-devices-table > thead > tr > th:nth-child(2) {
    min-width: 220px;
}

.backup-devices-table > thead > tr > th:nth-child(3) {
    min-width: 310px;
}

.backup-client-group-row > td {
    padding: 0.65rem 0.85rem;
    border-top: 8px solid #fff;
    border-left: 4px solid #64748b;
    background: #eef2f6;
}

.backup-client-group-row:first-child > td {
    border-top-width: 1px;
}

.backup-client-group-row.is-unmapped > td {
    border-left-color: #2563eb;
    background: #eff6ff;
}

.backup-client-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.backup-client-group > div:first-child {
    display: flex;
    gap: 0.65rem;
    align-items: baseline;
    min-width: 0;
}

.backup-client-label {
    color: #64748b;
    font-size: 0.63rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.backup-client-group strong {
    color: #172033;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.backup-client-count {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.backup-client-status-summary {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.backup-client-status-count {
    color: #475569;
    font-size: 0.68rem;
    font-weight: 750;
    white-space: nowrap;
}

.backup-client-status-count::before {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 0.3rem;
    border-radius: 50%;
    background: #94a3b8;
    content: "";
    vertical-align: 0.05em;
}

.backup-client-status-count.is-success::before {
    background: #22a06b;
}

.backup-client-status-count.is-warning::before {
    background: #d97706;
}

.backup-client-status-count.is-failure::before,
.backup-client-status-count.is-missed::before {
    background: #dc2626;
}

.backup-client-status-count.is-unmapped::before {
    background: #2563eb;
}

.backup-client-status-count.is-configuration::before {
    background: #6366f1;
}

.backup-device-row > td:first-child,
.backup-device-detail-row > td:first-child {
    border-left: 4px solid #e2e8f0;
}

.backup-hostname {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.backup-hostname strong,
.backup-hostname small {
    display: block;
}

.backup-device-plan-meta {
    color: #4f46e5 !important;
}

.backup-hostname strong {
    color: #172033;
    overflow-wrap: anywhere;
}

.backup-hostname small {
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.3;
}

.backup-device-indicator {
    flex: 0 0 auto;
    width: 11px;
    height: 14px;
    margin-top: 0.15rem;
    border: 1.5px solid #64748b;
    border-radius: 2px;
    background:
        linear-gradient(#64748b, #64748b) 2px 3px / 5px 1px no-repeat,
        linear-gradient(#64748b, #64748b) 2px 7px / 5px 1px no-repeat;
}

.backup-device-job-stack {
    display: grid;
    gap: 0.32rem;
}

.backup-device-job-summary {
    display: grid;
    grid-template-columns: 72px minmax(130px, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
    min-width: 0;
}

.backup-device-job-summary > span:nth-child(2) {
    min-width: 0;
}

.backup-device-job-summary strong,
.backup-device-job-summary small {
    display: block;
}

.backup-device-job-summary strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backup-device-job-summary small {
    margin-top: 0.08rem;
    color: var(--text-muted);
    font-size: 0.68rem;
}

.backup-job-kind {
    color: #475569;
    font-size: 0.66rem;
    font-weight: 850;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.backup-job-kind.is-configuration {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.16rem 0.36rem;
    color: #5b3fa3;
    border: 1px solid #d9cdf8;
    border-radius: 999px;
    background: #f6f2ff;
}

.backup-device-expand-cell {
    color: #475569;
    font-size: 0.72rem;
    font-weight: 750;
    text-align: right;
    white-space: nowrap;
}

.backup-device-chevron {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 1rem;
    transition: transform 0.15s ease;
}

.backup-device-row[aria-expanded="true"] .backup-device-chevron {
    transform: rotate(180deg);
}

.backup-device-detail-row > td {
    padding: 0;
    background: #f8fafc;
}

.backup-device-detail {
    padding: 0.9rem 1rem 1.15rem;
    border-top: 1px solid #dbe3ec;
    border-bottom: 1px solid #dbe3ec;
}

.backup-device-detail-heading {
    display: flex;
    gap: 1rem;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 0.55rem;
}

.backup-device-detail-heading strong,
.backup-device-detail-heading span {
    display: block;
}

.backup-device-plan-control {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.backup-device-plan-control label,
.backup-device-plan-control label span {
    display: block;
}

.backup-device-plan-control label span {
    margin-bottom: 0.2rem;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 750;
}

.backup-device-plan-control select {
    min-width: 220px;
    min-height: 34px;
}

.backup-device-plan-state {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-left: 3px solid #6366f1;
    background: #f5f3ff;
    color: #475569;
    font-size: 0.72rem;
}

.backup-device-plan-state strong {
    color: #312e81;
    white-space: nowrap;
}

.backup-device-plan-state.is-success {
    border-left-color: #16a36a;
    background: #ecfdf5;
}

.backup-device-plan-state.is-failure,
.backup-device-plan-state.is-missed {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.backup-plan-modal-card {
    width: min(1080px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.backup-plan-workspace {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 520px;
    margin-top: 0.8rem;
    border: 1px solid var(--border-color);
}

.backup-plan-list-panel {
    padding: 0.8rem;
    border-right: 1px solid var(--border-color);
    background: #f8fafc;
}

.backup-plan-list-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.backup-plan-list {
    display: grid;
    gap: 0.35rem;
}

.backup-plan-list-item {
    display: block;
    width: 100%;
    padding: 0.65rem;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #475569;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.backup-plan-list-item:hover,
.backup-plan-list-item.is-active {
    border-color: #cbd5e1;
    background: #fff;
}

.backup-plan-list-item strong,
.backup-plan-list-item span,
.backup-plan-list-item small {
    display: block;
}

.backup-plan-list-item strong {
    color: #172033;
    font-size: 0.78rem;
}

.backup-plan-list-item span,
.backup-plan-list-item small {
    margin-top: 0.18rem;
    font-size: 0.67rem;
}

.backup-plan-list-item small {
    color: var(--danger);
}

.backup-plan-editor {
    padding: 1rem;
}

.backup-plan-rule {
    padding: 0.75rem;
    border: 1px solid #dbe3ec;
    border-radius: 6px;
    background: #f8fafc;
}

.backup-plan-rule p {
    margin: 0.25rem 0 0.65rem;
}

.backup-plan-window {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.backup-plan-window label,
.backup-plan-window label span {
    display: block;
}

.backup-plan-window label span {
    margin-bottom: 0.2rem;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 750;
}

.backup-plan-clock {
    width: 78px;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    text-align: center;
}

.backup-plan-window-arrow {
    padding-bottom: 0.65rem;
    color: #64748b;
}

.backup-plan-window .time-picker-24-badge {
    margin-bottom: 0.72rem;
}

.backup-plan-window-help {
    margin: 0.75rem 0 0;
}

.backup-device-log-heading {
    margin-top: 1.1rem;
}

.backup-device-jobs-detail,
.backup-device-log-table {
    background: #fff;
}

.backup-device-log-table th:nth-child(5) {
    min-width: 240px;
}

.backup-latest-error {
    max-width: 520px;
    margin-top: 0.35rem;
    color: var(--danger);
    font-size: 0.75rem;
    line-height: 1.35;
}

.backup-run-items {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.backup-run-items li + li {
    margin-top: 0.25rem;
}

.backup-job-modal-card {
    width: min(760px, calc(100vw - 2rem));
}

.backup-job-editor-form {
    margin-bottom: 0;
}

.backup-job-editor-form .field-span-2 {
    grid-column: 1 / -1;
}

.backup-job-form-step {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-top: 0.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.backup-job-form-step:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.backup-job-form-step > span {
    display: inline-grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 850;
}

.backup-job-form-step > div,
.backup-job-role-auto > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
}

.backup-job-form-step strong,
.backup-job-role-auto strong,
.backup-job-fallback-heading strong {
    color: var(--text-main);
    font-size: 0.9rem;
}

.backup-job-form-step small,
.backup-job-role-auto small,
.backup-job-fallback-heading small {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.backup-job-plan-summary {
    padding: 0.65rem 0.75rem;
    border-left: 3px solid #2563eb;
    background: #eff6ff;
    color: #1e3a5f;
    font-size: 0.75rem;
    line-height: 1.4;
}

.backup-job-plan-summary[hidden],
.backup-job-role-auto[hidden],
.backup-job-fallback-heading[hidden] {
    display: none;
}

.backup-job-role-auto {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.8rem 0.9rem;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #f0fdf4;
}

.backup-job-role-auto > span {
    flex: 0 0 auto;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.backup-job-fallback-heading {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 0.2rem;
}

.backup-job-suggestion {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0 0;
    padding: 0.85rem 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a5f;
}

.backup-job-suggestion[hidden] {
    display: none;
}

.backup-job-suggestion p {
    margin: 0.2rem 0 0;
}

.backup-schedule-hint {
    max-width: 260px;
    margin-top: 0.35rem;
    color: #2563eb;
    font-size: 0.7rem;
    line-height: 1.35;
}

.backup-message-modal-card {
    width: min(1040px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
}

.backup-message-frame {
    width: 100%;
    height: min(70vh, 760px);
    margin-top: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
}

.time-picker-24 {
    display: grid;
    grid-template-columns: minmax(62px, 1fr) auto minmax(62px, 1fr) auto;
    align-items: center;
    min-height: 42px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.time-picker-24:focus-within {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.time-picker-24 select {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 0.7rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    text-align: center;
    text-align-last: center;
    outline: 0;
}

.time-picker-24 select:disabled {
    color: #94a3b8;
    background: #f8fafc;
    cursor: not-allowed;
}

.time-picker-24-separator {
    color: #334155;
    font-size: 1.1rem;
    font-weight: 850;
}

.time-picker-24-badge {
    margin-right: 0.55rem;
    padding: 0.2rem 0.38rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
}

@media (max-width: 1100px) {
    .backup-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .backup-device-job-summary {
        grid-template-columns: 68px minmax(120px, 1fr);
    }

    .backup-device-job-summary .status-pill {
        grid-column: 2;
        justify-self: start;
    }
}

@media (max-width: 620px) {
    .backup-summary-grid {
        grid-template-columns: 1fr;
    }

    .backup-job-suggestion {
        align-items: stretch;
        flex-direction: column;
    }

    .backup-device-section-header,
    .backup-device-detail-heading,
    .backup-client-group {
        align-items: flex-start;
        flex-direction: column;
    }

    .backup-client-group > div:first-child {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }

    .backup-client-status-summary {
        justify-content: flex-start;
    }

    .backup-plan-workspace {
        grid-template-columns: 1fr;
    }

    .backup-plan-list-panel {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .backup-plan-window,
    .backup-device-plan-control,
    .backup-device-plan-state {
        align-items: stretch;
        flex-direction: column;
    }

    .backup-plan-window-arrow {
        display: none;
    }
}
.peppol-import-page {
    display: grid;
    gap: 18px;
}

.peppol-history-row {
    cursor: pointer;
}

.peppol-history-row:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.peppol-history-row.is-expanded > td {
    background: rgba(var(--primary-rgb), 0.06);
    border-bottom-color: rgba(var(--primary-rgb), 0.28);
}

.peppol-history-detail-row > .peppol-history-detail-cell {
    padding: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(245, 240, 234, 0.88));
}

.peppol-history-detail-row:hover,
.peppol-history-detail-row:nth-child(even) {
    background: transparent;
}

.peppol-history-detail-cell > .peppol-workspace {
    min-width: 0;
}

.peppol-upload-actions,
.peppol-import-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.peppol-workspace {
    display: grid;
    gap: 18px;
}

.peppol-party-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

.peppol-details-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    margin: 0;
}

.peppol-details-list > div {
    min-width: 0;
}

.peppol-details-list dt {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 3px;
}

.peppol-details-list dd {
    color: var(--text-main);
    margin: 0;
    overflow-wrap: anywhere;
}

.peppol-detail-divider {
    border-top: 1px solid var(--border-color);
    margin: 18px 0;
}

.peppol-horizon-supplier {
    align-items: flex-end;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
}

.peppol-horizon-supplier label {
    flex: 1;
}

.peppol-tax-layout {
    display: grid;
    grid-template-columns: minmax(260px, .7fr) minmax(420px, 1.3fr);
    gap: 24px;
}

.peppol-lines-wrap {
    max-height: 620px;
    overflow: auto;
}

.peppol-lines-table {
    min-width: 1120px;
}

.peppol-lines-table td strong,
.peppol-lines-table td small,
.peppol-horizon-match strong,
.peppol-horizon-match small {
    display: block;
}

.peppol-lines-table td small {
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 3px;
    max-width: 460px;
}

.peppol-horizon-match {
    min-width: 180px;
}

.peppol-attachments-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
    gap: 16px;
}

.peppol-attachments-list {
    display: grid;
    align-content: start;
    gap: 8px;
}

.peppol-attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border-color);
    padding: 11px 12px;
}

.peppol-attachment-item strong,
.peppol-attachment-item span,
.peppol-attachment-item small {
    display: block;
}

.peppol-attachment-item span,
.peppol-attachment-item small {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.peppol-attachment-preview iframe {
    display: block;
    width: 100%;
    min-height: 620px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
}

.peppol-import-actions label {
    min-width: 112px;
}

.peppol-nomenclature-actions,
.digitization-nomenclature-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.peppol-group-picker .peppol-group-tree-dropdown {
    grid-column: 1 / -1;
    border: 1px solid var(--border-color);
    background: var(--card-background);
}

.peppol-group-tree-dropdown > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    padding: 11px 13px;
    list-style: none;
}

.peppol-group-tree-dropdown > summary::-webkit-details-marker {
    display: none;
}

.peppol-group-tree-dropdown > summary::after {
    content: "▾";
    color: var(--text-muted);
}

.peppol-group-tree-dropdown[open] > summary::after {
    content: "▴";
}

.peppol-group-tree-dropdown > summary span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.peppol-group-tree-dropdown > summary strong {
    flex: 1;
    text-align: right;
}

.peppol-group-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding: 9px 10px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.peppol-group-tree-toolbar > div {
    display: flex;
    gap: 6px;
}

.peppol-group-tree-dropdown .nom-group-tree {
    border-width: 1px 0 0;
    max-height: min(42vh, 420px);
}

.peppol-raw-card summary {
    cursor: pointer;
    font-weight: 700;
}

.peppol-raw-card pre {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-height: 520px;
    overflow: auto;
    padding: 14px;
    white-space: pre-wrap;
}

@media (max-width: 1080px) {
    .peppol-party-grid,
    .peppol-tax-layout,
    .peppol-attachments-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .peppol-details-list {
        grid-template-columns: 1fr;
    }

    .peppol-horizon-supplier,
    .peppol-upload-actions,
    .peppol-import-actions,
    .peppol-nomenclature-actions,
    .digitization-nomenclature-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .peppol-group-tree-dropdown > summary,
    .peppol-group-tree-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .peppol-group-tree-dropdown > summary strong {
        text-align: left;
    }

    .peppol-attachment-item {
        align-items: stretch;
        flex-direction: column;
    }

    .peppol-attachment-preview iframe {
        min-height: 440px;
    }
}

/* Quoting workspace */
.quoting-page {
    display: grid;
    gap: 1.25rem;
}

.quoting-heading-row {
    align-items: flex-start;
}

.quoting-heading-row .page-description {
    max-width: 850px;
}

.quoting-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.quote-library,
.quote-editor {
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    background: #fff;
}

.quote-library {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quote-library-header,
.quote-editor-header,
.quote-items-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.quote-library-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.quote-library-header h3,
.quote-editor-header h3,
.quote-product-entry h4,
.quote-items-toolbar h4 {
    margin: 0;
}

.quote-library-header p,
.quote-editor-header p,
.quote-product-entry p,
.quote-items-toolbar p {
    margin: 0.2rem 0 0;
}

.quote-library-filters {
    display: grid;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.quote-library-filters label,
.quote-meta-grid label,
.quote-product-entry-grid label {
    display: grid;
    gap: 0.35rem;
}

.quote-library-filters label > span,
.quote-meta-grid label > span,
.quote-product-entry-grid label > span {
    color: #4b5563;
    font-size: 0.76rem;
    font-weight: 700;
}

.quote-library-list {
    min-height: 180px;
    overflow: auto;
    padding: 0.5rem;
}

.quote-library-card {
    width: 100%;
    display: grid;
    gap: 0.22rem;
    padding: 0.75rem;
    border: 1px solid transparent;
    border-bottom-color: #e5e7eb;
    border-radius: 6px;
    background: transparent;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.quote-library-card:hover {
    background: #f8fafc;
}

.quote-library-card.is-active {
    border-color: #ef4444;
    background: #fff7f7;
}

.quote-library-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.quote-library-title {
    font-weight: 700;
}

.quote-library-client,
.quote-library-meta {
    color: #6b7280;
    font-size: 0.78rem;
}

.quote-library-total {
    margin-top: 0.18rem;
    color: #111827;
    font-size: 0.82rem;
    font-weight: 700;
}

.quote-editor {
    min-width: 0;
    overflow: hidden;
}

.quote-editor-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.quote-editor-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.quote-editor > .alert,
.quote-editor > [id$="-alert"] {
    margin-inline: 1.25rem;
}

.quote-meta-grid {
    display: grid;
    grid-template-columns: minmax(200px, 1.5fr) minmax(180px, 1.2fr) minmax(110px, 0.5fr) minmax(130px, 0.6fr);
    gap: 0.8rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.quote-notes-field {
    grid-column: 1 / -1;
}

.quote-notes-field textarea {
    resize: vertical;
}

.quote-product-entry {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.quote-product-entry-copy {
    margin-bottom: 0.75rem;
}

.quote-product-entry-copy p,
.quote-acc-hint {
    color: #6b7280;
    font-size: 0.8rem;
}

.quote-product-entry-grid {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(110px, 0.5fr) minmax(200px, 1.35fr) 90px auto;
    gap: 0.65rem;
    align-items: end;
}

.quote-product-entry-grid .button-cell {
    padding: 0;
}

.quote-product-entry-grid .button-cell button {
    white-space: nowrap;
}

.quote-acc-hint {
    margin: 0.55rem 0 0;
}

.quote-items-toolbar {
    padding: 1rem 1.25rem 0.7rem;
}

.quote-compatibility {
    margin: 0.1rem 1.25rem 1rem;
    padding: 1rem;
    border: 1px solid #dfe3e8;
    border-left: 4px solid #9ca3af;
    border-radius: 8px;
    background: #f8fafc;
}

.quote-compatibility.is-ok { border-left-color: #16a34a; background: #f0fdf4; }
.quote-compatibility.is-error { border-left-color: #dc2626; background: #fff7f7; }
.quote-compatibility.is-warning { border-left-color: #d97706; background: #fffbeb; }
.quote-compatibility.is-partial,
.quote-compatibility.is-unknown { border-left-color: #64748b; }
.quote-compatibility.is-loading { opacity: 0.78; }

.quote-compatibility-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.quote-compatibility-header h4 {
    margin: 0.12rem 0 0;
}

.quote-compatibility-kicker {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.quote-compatibility-status {
    flex: 0 0 auto;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 800;
}

.quote-compatibility.is-ok .quote-compatibility-status { background: #dcfce7; color: #166534; }
.quote-compatibility.is-error .quote-compatibility-status { background: #fee2e2; color: #991b1b; }
.quote-compatibility.is-warning .quote-compatibility-status { background: #fef3c7; color: #92400e; }

.quote-compatibility-summary {
    margin: 0.55rem 0 0;
    color: #475569;
    font-size: 0.82rem;
}

.quote-compatibility-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: 0.55rem;
    margin-top: 0.8rem;
}

.quote-compatibility-check {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: start;
    min-height: 66px;
    padding: 0.65rem;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.9);
}

.quote-compatibility-check-icon {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 999px;
    background: #e5e7eb;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 900;
}

.quote-compatibility-check.is-pass .quote-compatibility-check-icon { background: #dcfce7; color: #166534; }
.quote-compatibility-check.is-error .quote-compatibility-check-icon { background: #fee2e2; color: #991b1b; }
.quote-compatibility-check.is-warning .quote-compatibility-check-icon { background: #fef3c7; color: #92400e; }

.quote-compatibility-check strong,
.quote-compatibility-check span {
    display: block;
}

.quote-compatibility-check strong {
    color: #1f2937;
    font-size: 0.78rem;
}

.quote-compatibility-check span:not(.quote-compatibility-check-icon) {
    margin-top: 0.18rem;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.35;
}

.quote-compatibility-note {
    margin: 0.7rem 0 0;
    color: #64748b;
    font-size: 0.7rem;
}

.quote-items-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.quote-items-table {
    min-width: 1120px;
    margin: 0;
}

.quote-items-table td {
    vertical-align: middle;
}

.quote-items-table th:nth-child(1) { width: 145px; }
.quote-items-table th:nth-child(2) { width: 125px; }
.quote-items-table th:nth-child(3) { min-width: 260px; }
.quote-items-table th:nth-child(4) { width: 72px; }
.quote-items-table th:nth-child(5) { width: 155px; }
.quote-items-table th:nth-child(6) { width: 110px; }
.quote-items-table th:nth-child(7),
.quote-items-table th:nth-child(8) { width: 110px; }
.quote-items-table th:nth-child(9) { width: 82px; }

.quote-line-select,
.quote-line-name,
.quote-line-number {
    width: 100%;
    min-width: 0;
    padding: 0.4rem 0.45rem;
    font-size: 0.82rem;
}

.quote-line-quantity { min-width: 58px; }
.quote-line-price { min-width: 90px; text-align: right; }

.quote-sku-link,
.quote-sku-text {
    display: block;
    margin-top: 0.18rem;
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.quote-availability-cell small {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.68rem;
}

.quote-availability {
    display: inline-flex;
    padding: 0.18rem 0.42rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 700;
}

.quote-availability.is-success { background: #ecfdf3; color: #166534; }
.quote-availability.is-warning { background: #fffbeb; color: #92400e; }
.quote-availability.is-danger { background: #fef2f2; color: #991b1b; }

.quote-line-actions {
    display: flex;
    gap: 0.3rem;
}

.quote-line-actions .btn-small {
    min-width: 32px;
    padding-inline: 0.4rem;
}

.quote-totals {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    padding: 1rem 1.25rem;
    background: #f8fafc;
}

.quote-totals > div {
    min-width: 155px;
    padding: 0.3rem 1rem;
    border-left: 1px solid #dfe3e8;
}

.quote-totals span,
.quote-totals strong {
    display: block;
    text-align: right;
}

.quote-totals span {
    color: #6b7280;
    font-size: 0.75rem;
}

.quote-totals strong {
    margin-top: 0.2rem;
    font-size: 1.02rem;
}

.quote-total-primary strong {
    color: #b91c1c;
    font-size: 1.2rem;
}

.quote-status-draft { background: #f3f4f6; color: #4b5563; }
.quote-status-sent { background: #eff6ff; color: #1d4ed8; }
.quote-status-accepted { background: #ecfdf3; color: #166534; }
.quote-status-declined { background: #fef2f2; color: #991b1b; }

@media (max-width: 1280px) {
    .quoting-layout {
        grid-template-columns: 260px minmax(0, 1fr);
    }
    .quote-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .quote-product-entry-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
    .quote-sku-field { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .quoting-layout { grid-template-columns: 1fr; }
    .quote-library { position: static; max-height: 420px; }
    .quote-editor-header { align-items: flex-start; flex-direction: column; }
    .quote-editor-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 620px) {
    .quote-meta-grid,
    .quote-product-entry-grid { grid-template-columns: 1fr; }
    .quote-notes-field,
    .quote-sku-field { grid-column: auto; }
    .quote-totals { flex-direction: column; }
    .quote-totals > div { border-left: 0; border-top: 1px solid #dfe3e8; }
}
/* Quoting full-width editor and compact saved quote library */
.quoting-layout {
    grid-template-columns: minmax(0, 1fr);
}

.quote-library {
    position: static;
    display: block;
    max-height: none;
    overflow: visible;
}

.quote-library-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;
}

.quote-library-summary::-webkit-details-marker {
    display: none;
}

.quote-library-summary-copy {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    min-width: 0;
}

.quote-library-summary-copy strong {
    color: #111827;
}

.quote-library-summary-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 700;
}

.quote-library-summary-action::after {
    content: '▾';
    font-size: 0.85rem;
}

.quote-library[open] .quote-library-summary-action::after {
    transform: rotate(180deg);
}

.quote-library-content {
    border-top: 1px solid #e5e7eb;
}

.quote-library-filters {
    grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.7fr) auto;
    align-items: end;
}

.quote-library-refresh-cell {
    padding-bottom: 1px;
}

.quote-library-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
    min-height: 0;
    max-height: 360px;
}

.quote-library-card {
    border-color: #e5e7eb;
}

.quote-client-picker {
    position: relative;
}

.quote-client-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.quote-client-suggestions[hidden] {
    display: none;
}

.quote-client-suggestion {
    width: 100%;
    display: grid;
    gap: 0.15rem;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.quote-client-suggestion:hover,
.quote-client-suggestion:focus-visible {
    background: #f8fafc;
}

.quote-client-suggestion span,
.quote-client-suggestion-empty {
    color: #6b7280;
    font-size: 0.76rem;
}

.quote-client-suggestion-empty {
    padding: 0.75rem;
}

.quote-product-cell {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.quote-product-thumb {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: block;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.quote-product-cell .quote-line-name {
    flex: 1 1 auto;
}

@media (max-width: 720px) {
    .quote-library-summary-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.1rem;
    }

    .quote-library-filters {
        grid-template-columns: 1fr;
    }

    .quote-library-refresh-cell button {
        width: 100%;
    }
}
.quote-product-image-button {
    flex: 0 0 46px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: zoom-in;
}

.quote-product-image-button:hover .quote-product-thumb,
.quote-product-image-button:focus-visible .quote-product-thumb {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.quote-gallery-open {
    overflow: hidden;
}

.quote-image-modal-card {
    width: min(980px, 100%);
    max-height: calc(100vh - 2rem);
    display: grid;
    gap: 0.85rem;
    overflow: auto;
}

.quote-image-modal-header,
.quote-image-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.quote-image-modal-header h3,
.quote-image-modal-header p,
.quote-image-modal-status {
    margin: 0;
}

.quote-image-stage {
    min-height: min(62vh, 620px);
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.quote-image-stage > img {
    width: 100%;
    max-height: min(60vh, 590px);
    display: block;
    object-fit: contain;
}

.quote-image-nav {
    width: 44px;
    height: 58px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.quote-image-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.quote-image-footer > span {
    flex: 0 0 auto;
    color: #4b5563;
    font-size: 0.8rem;
    font-weight: 700;
}

.quote-image-thumbnails {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    overflow-x: auto;
}

.quote-image-thumbnail {
    width: 62px;
    height: 54px;
    flex: 0 0 62px;
    padding: 3px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.quote-image-thumbnail.is-active {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.quote-image-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

@media (max-width: 620px) {
    .quote-image-modal-card {
        max-height: calc(100vh - 1rem);
    }

    .quote-image-stage {
        min-height: 55vh;
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        gap: 0.35rem;
        padding: 0.5rem;
    }

    .quote-image-nav {
        width: 34px;
        height: 48px;
    }

    .quote-image-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}
/* Billing control uses the shared shell and flat, expandable evidence tables. */
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.billing-finding { border-bottom: 1px solid #d1d5db; padding: 12px 0; }
.billing-finding summary, .billing-client-row { cursor: pointer; }
.billing-review { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.billing-review label { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 180px; }
.billing-evidence { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.billing-evidence p, .billing-evidence li { overflow-wrap: anywhere; }
.billing-attention { color: #92400e; background: #fffbeb; font-weight: 700; }
.billing-detail-row > td { background: #f9fafb; color: #111827; white-space: normal; }
.billing-control-page .card { margin-bottom: 16px; }
@media (max-width: 800px) { .billing-evidence { grid-template-columns: 1fr; } }
.allocation-part { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; margin: 0.75rem 0; }
#allocation-editor { border-top: 1px solid #d1d5db; margin-top: 1rem; padding-top: 1rem; }
#allocation-rows tr[data-allocation-source] { cursor: pointer; }
#client-allocation-panel .filter-row { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; }
#client-allocation-panel label { display: flex; flex-direction: column; gap: 0.35rem; }
#client-allocation-panel label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; align-self: center; }
#client-allocation-panel input[type="checkbox"] { width: auto; margin: 0; }
#client-allocation-panel summary { cursor: pointer; font-weight: 600; }
#client-arrow-accounts > div { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
