@font-face {
    font-family: "Vazirmatn";
    src: url("../vendor/vazirmatn/Vazirmatn-Variable.f6d31671339d.woff2") format("woff2-variations");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --app-font: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    --app-bg: #f3f6f8;
    --app-ink: #17262e;
    --app-muted: #6f7f88;
    --app-primary: #0f6b64;
    --app-primary-dark: #0a4e49;
    --app-accent: #c9912f;
    --app-border: #dfe7e9;
}

body {
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: var(--app-font);
    font-feature-settings: "ss01" 1;
    min-height: 100vh;
}

.app-navbar { background: linear-gradient(100deg, #0b3f3b, #0f6b64); }
.app-navbar .nav-link { color: rgba(255, 255, 255, .74); }
.app-navbar .nav-link:hover { color: #fff; }
.btn-primary { --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary-dark); --bs-btn-hover-border-color: var(--app-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--app-primary); --bs-btn-border-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary); --bs-btn-hover-border-color: var(--app-primary); }
.app-card, .metric-card { background: #fff; box-shadow: 0 8px 24px rgba(24, 53, 61, .06); border-radius: 16px; }
.metric-card { padding: 22px; display: flex; min-height: 150px; flex-direction: column; }
.metric-label, .metric-meta { color: var(--app-muted); }
.metric-value { color: var(--app-primary-dark); font-size: 2.25rem; margin: auto 0 .15rem; }
.metric-value small { color: var(--app-muted); font-size: .85rem; font-weight: 500; }
.metric-meta { font-size: .8rem; }
.eyebrow { color: var(--app-accent); font-size: .78rem; font-weight: 700; letter-spacing: .04em; }
.table > :not(caption) > * > * { padding: .9rem 1rem; border-color: var(--app-border); }
.table thead th { color: var(--app-muted); font-size: .8rem; font-weight: 600; background: #f8fafb; white-space: nowrap; }
.form-control { border-color: #d8e1e4; min-height: 42px; }
.form-control:focus { border-color: var(--app-primary); box-shadow: 0 0 0 .2rem rgba(15, 107, 100, .12); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.empty-result { min-height: 300px; justify-content: center; align-items: center; text-align: center; }
.empty-icon, .brand-mark { display: grid; place-items: center; background: #e3f1ef; color: var(--app-primary); font-weight: 800; border-radius: 18px; }
.empty-icon { width: 58px; height: 58px; font-size: 1.7rem; margin-bottom: 1rem; }
.brand-mark { width: 70px; height: 70px; font-size: 1.4rem; }
.result-hero { background: linear-gradient(135deg, #eff8f6, #f8fbfa); border: 1px solid #dcece9; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; }
.result-hero span, .result-cell span { color: var(--app-muted); font-size: .78rem; }
.result-hero strong { font-size: 1.85rem; margin-top: .4rem; }
.result-hero small { color: var(--app-muted); }
.result-cell { height: 100%; background: #f8fafb; border: 1px solid #edf1f2; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: .35rem; }
.result-cell.emphasis { background: #fff8e9; border-color: #f1dfb8; }
.login-shell { min-height: calc(100vh - 3rem); display: grid; place-items: center; }
.login-card { width: min(100%, 440px); border-radius: 20px; }
.detail-table th { color: var(--app-muted); font-weight: 500; }
.detail-table td { text-align: left; direction: ltr; font-weight: 600; }

.dashboard-progress {
    height: .5rem;
    background: #e8efef;
}

.dashboard-progress .progress-bar {
    background: linear-gradient(90deg, var(--app-primary), #2c938a);
}

.dashboard-metric-card {
    min-height: 135px;
}

.dashboard-submetric {
    display: flex;
    min-height: 92px;
    flex-direction: column;
    justify-content: space-between;
    padding: .8rem;
    border: 1px solid var(--app-border);
    border-radius: .8rem;
    background: #f7f9fa;
}

.dashboard-submetric span {
    color: var(--app-muted);
    font-size: .78rem;
}

.dashboard-submetric strong {
    color: var(--app-primary-dark);
    font-size: 1.55rem;
}

.dashboard-submetric.is-allocation {
    border-color: #e5c98e;
    background: #fff8e9;
}

.dashboard-submetric.is-negotiation {
    border-color: #b9d8d4;
    background: #eff8f6;
}

.dashboard-alert {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    margin-bottom: .65rem;
    padding: .75rem .85rem;
    border-right: 3px solid #85949b;
    border-radius: .7rem;
    background: #f7f9fa;
}

.dashboard-alert strong { font-size: .86rem; }
.dashboard-alert span { color: var(--app-muted); font-size: .78rem; }
.dashboard-alert.is-warning { border-right-color: #cf942b; background: #fff9ed; }
.dashboard-alert.is-info { border-right-color: #4b83a9; background: #f1f7fb; }
.dashboard-alert.is-success { border-right-color: #27846f; background: #eff8f5; }

@media (max-width: 767px) {
    .metric-value { font-size: 1.8rem; }
    .result-hero strong { font-size: 1.35rem; }
}

.pricing-global-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(118px, 1fr));
    gap: .75rem;
    overflow-x: auto;
    padding-bottom: .25rem;
}

.pricing-assumptions-row > .col {
    min-width: 0;
}

.pricing-assumptions-row .form-label {
    min-height: 2.25rem;
    display: flex;
    align-items: end;
    margin-bottom: .35rem;
}

.pricing-assumptions-row .input-group-text {
    padding-inline: .5rem;
    white-space: nowrap;
}

.pricing-derived-metric {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .85rem 1rem;
    border: 1px solid #d9e7e5;
    border-radius: .8rem;
    background: #f5faf9;
}

.pricing-derived-metric span {
    color: var(--app-muted);
    font-size: .78rem;
}

.pricing-derived-metric strong {
    color: var(--app-primary-dark);
}

.pricing-derived-metric.is-ceiling {
    border-color: #ead39d;
    background: #fff9ec;
}

.pricing-lot-card {
    border-right: 4px solid var(--app-primary, #0f6b64);
}

.pricing-lot-card.is-withdrawn {
    border-right-color: #8b969b;
    background: #fafbfb;
}

.pricing-lot-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem 1.25rem;
    color: var(--bs-secondary-color);
    font-size: .86rem;
}

.offer-code-badge {
    display: inline-flex;
    align-items: center;
    padding: .3rem .55rem;
    border: 1px solid #b9d5d2;
    border-radius: 999px;
    background: #edf7f5;
    color: var(--app-primary-dark);
    font-size: .78rem;
    font-weight: 700;
}

.offer-code-preview-table {
    min-width: 940px;
}

.pricing-competitor-panel,
.pricing-quality-panel {
    padding: 1rem;
    border: 1px solid var(--app-border, #dce4e7);
    border-radius: .9rem;
    background: #f8fbfb;
}

.pricing-quality-panel.has-warning {
    border-color: #e1bd72;
    background: #fffaf0;
}

.pricing-quality-panel ul {
    padding-right: 1.15rem;
}

.competitor-evidence-chip {
    display: inline-flex;
    min-width: 180px;
    flex-direction: column;
    gap: .15rem;
    padding: .55rem .7rem;
    border: 1px solid #b9d5d2;
    border-radius: .75rem;
    background: #fff;
}

.competitor-evidence-chip span {
    color: var(--bs-secondary-color);
    font-size: .72rem;
}

.competitor-evidence-chip.is-unknown {
    border-style: dashed;
    border-color: #8794c9;
    background: #f7f8fe;
}

.pricing-ladder-horizontal {
    min-width: 1030px;
    table-layout: fixed;
}

.pricing-ladder-horizontal .pricing-row-label {
    width: 145px;
    min-width: 145px;
    text-align: right;
    white-space: nowrap;
    background: #f7f9fa;
}

.pricing-ladder-horizontal th:not(.pricing-row-label),
.pricing-ladder-horizontal td:not(.pricing-row-label) {
    min-width: 125px;
}

.pricing-ladder-horizontal .pricing-percent-input input {
    width: 100%;
    min-width: 0;
}

.pricing-ladder-horizontal .input-group-text {
    padding-inline: .45rem;
}

.pricing-ladder-horizontal td {
    font-size: .82rem;
    white-space: nowrap;
}

.pricing-ladder-scroll {
    scrollbar-width: thin;
}

.price-review-chip {
    display: inline-flex;
    padding: .25rem .45rem;
    border: 1px solid #d6e0e2;
    border-radius: .5rem;
    background: #f7f9fa;
    font-size: .75rem;
}

.pricing-review-table td:last-child {
    min-width: 520px;
}

@media (max-width: 991px) {
    .pricing-global-grid {
        grid-template-columns: repeat(7, 120px);
    }
}

@media (max-width: 767px) {
    .pricing-assumptions-row .form-label {
        min-height: auto;
    }
}

.chart-shell {
    overflow: hidden;
    min-height: 430px;
}

.chart-shell .plotly-graph-div {
    max-width: 100%;
}

.analytics-table th,
.analytics-table td {
    white-space: nowrap;
}

.profile-facts dt,
.profile-facts dd {
    padding-top: .55rem;
    padding-bottom: .55rem;
    border-bottom: 1px solid #edf1f2;
    margin-bottom: 0;
}

.profile-facts dd {
    direction: ltr;
    text-align: left;
    font-weight: 700;
}

.compact-metric {
    min-height: 125px;
    padding: 18px 20px;
}

.compact-metric .metric-value {
    font-size: 1.9rem;
}

.status-pill,
.relation-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: .3rem .65rem;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-draft { background: #eef2f4; color: #52636d; }
.status-active { background: #dff3ef; color: #0a655d; }
.status-archived { background: #f2edf8; color: #6d4f8c; }
.relation-confirmed { background-color: #d8f1ec; color: #08675e; }
.relation-likely { background-color: #dceaf8; color: #245d8c; }
.relation-possible { background-color: #f0f3f4; color: #5a6a73; }
.relation-unknown { background-color: #fafbfb; color: #89969d; }
.relation-absent { background-color: #fde7e5; color: #a83d34; }
.decision-badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: .16rem .45rem;
    font-size: .65rem;
    font-weight: 700;
    white-space: nowrap;
}
.decision-negotiating { background: #e8eef6; color: #49647e; }
.decision-base_price { background: #dff3ef; color: #0a655d; }
.decision-competing { background: #fbe9ee; color: #8a3f55; }
.decision-withdrawn { background: #edf0f1; color: #68777e; }
.decision-won { background: #fff1cf; color: #805d19; }
.decision-lost { background: #f3e7e5; color: #91463f; }
.behavior-badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: .16rem .45rem;
    font-size: .65rem;
    font-weight: 700;
    white-space: nowrap;
}
.behavior-aggressive { background: #fbe7e2; color: #a44434; }
.behavior-quota_focused { background: #e4ebf7; color: #385d9c; }
.behavior-mixed { background: #eeeaf7; color: #67578d; }
.behavior-cooperative { background: #e2f3ed; color: #246f5b; }
.behavior-unknown { background: #eef1f2; color: #6c7a81; }

.analytics-hierarchy-table .analytics-group-row > * {
    background: color-mix(in srgb, var(--analytics-group-color) 8%, white);
}

.analytics-hierarchy-table .analytics-group-row > :first-child {
    border-right: 4px solid var(--analytics-group-color);
}

.analytics-group-heading {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.analytics-group-heading small {
    display: block;
    margin-top: .15rem;
    color: var(--app-muted);
    font-size: .68rem;
}

.analytics-group-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1.7rem;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-ink);
}

.analytics-group-toggle:hover { background: rgba(15, 107, 100, .08); }

.analytics-group-chevron {
    color: var(--analytics-group-color);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    transition: transform .16s ease;
}

.analytics-group-toggle[aria-expanded="true"] .analytics-group-chevron {
    transform: rotate(-90deg);
}

.analytics-member-row > * {
    background: #fbfcfc;
}

.analytics-member-row > :first-child {
    position: relative;
    padding-right: 2rem;
}

.analytics-member-indent {
    position: absolute;
    top: 0;
    right: .8rem;
    width: .75rem;
    height: 50%;
    border-right: 1px solid #b9c4c8;
    border-bottom: 1px solid #b9c4c8;
    border-bottom-right-radius: 5px;
}

.data-entry-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.data-entry-steps a {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .9rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
    color: var(--app-ink);
    text-decoration: none;
    font-size: .85rem;
}

.data-entry-steps span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e3f1ef;
    color: var(--app-primary);
    font-weight: 700;
}

.weekly-lot-form-table {
    max-height: 610px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
}

.weekly-lot-form-table thead {
    position: sticky;
    top: 0;
    z-index: 4;
}

.weekly-lot-form-table .form-control,
.weekly-lot-form-table .form-select {
    min-width: 120px;
}

.weekly-lot-form-table .table > :not(caption) > * > * {
    padding: .65rem .7rem;
    vertical-align: top;
}

.weekly-lot-form-table input[name$="-display_order"] {
    min-width: 72px;
    width: 72px;
}

.weekly-lot-form-table input[name$="-base_price_irr_per_kg"] {
    min-width: 165px;
}

.weekly-lot-form-table input[name$="-demand_count"] {
    min-width: 110px;
}

.weekly-lot-form-table select[name$="-known_demanders"] {
    min-width: 235px;
    min-height: 8rem;
}

.known-demanders-field {
    position: relative;
    min-width: 260px;
}

.known-demanders-field.is-enhanced > select {
    display: none;
}

.known-demanders-field.has-limit-error .known-demanders-limit {
    color: #b14339 !important;
}

.demander-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    min-height: 31px;
    margin-bottom: .45rem;
}

.demander-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    max-width: 100%;
    padding: .28rem .55rem;
    border: 1px solid #b8ddd7;
    border-radius: 999px;
    background: #e8f5f2;
    color: var(--app-primary-dark);
    font: inherit;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.2;
}

.demander-chip:hover,
.demander-chip:focus {
    border-color: #db8a80;
    background: #fff0ee;
    color: #9b3f36;
}

.demander-chip-remove {
    font-size: 1rem;
    line-height: .75;
}

.demander-chips-empty {
    color: var(--app-muted);
    font-size: .75rem;
}

.demander-add-button {
    padding: .3rem .65rem;
    font-size: .75rem;
}

.demander-picker-panel {
    width: min(100%, 330px);
    margin-top: .55rem;
    padding: .65rem;
    border: 1px solid #cfdcdf;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(24, 53, 61, .12);
}

.demander-picker-results {
    max-height: 190px;
    margin-top: .45rem;
    overflow-y: auto;
    border: 1px solid #edf1f2;
    border-radius: 8px;
}

.demander-picker-option {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .5rem .6rem;
    border: 0;
    border-bottom: 1px solid #edf1f2;
    background: #fff;
    color: var(--app-ink);
    font: inherit;
    font-size: .78rem;
    text-align: right;
}

.demander-picker-option:last-child {
    border-bottom: 0;
}

.demander-picker-option:hover,
.demander-picker-option:focus {
    background: #edf7f5;
    color: var(--app-primary-dark);
}

.demander-picker-add-mark {
    display: grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: #e3f1ef;
    color: var(--app-primary);
    font-weight: 800;
}

.demander-picker-empty,
.demander-picker-hint {
    padding: .55rem;
    color: var(--app-muted);
    font-size: .7rem;
}

.demander-picker-hint {
    padding-bottom: 0;
}

.weekly-lot-form-table input[name$="-notes"] {
    min-width: 190px;
}

.lot-file-import-panel {
    padding: 0;
    border: 1px solid #d9e8e5;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5fbfa, #fff);
}

.lot-file-import-summary {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem 1rem;
    cursor: pointer;
    list-style: none;
}

.lot-file-import-summary::-webkit-details-marker {
    display: none;
}

.lot-file-import-summary::after {
    margin-right: auto;
    color: var(--app-primary);
    content: "＋";
    font-size: 1.25rem;
    font-weight: 700;
}

.lot-file-import-panel[open] .lot-file-import-summary {
    border-bottom: 1px solid #d9e8e5;
}

.lot-file-import-panel[open] .lot-file-import-summary::after {
    content: "−";
}

.lot-file-import-content {
    padding: 1.15rem;
}

.file-import-icon {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--app-primary);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.file-format-guide {
    padding: 1rem;
    border: 1px dashed #c9dbd8;
    border-radius: 12px;
    background: rgba(255, 255, 255, .8);
}

.file-format-guide code {
    padding: .35rem .55rem;
    border-radius: 7px;
    background: #e7f2f0;
    color: var(--app-primary-dark);
    direction: rtl;
}

.file-format-guide li + li {
    margin-top: .35rem;
}

.manual-entry-label {
    color: var(--app-primary-dark);
    font-size: .82rem;
    font-weight: 700;
}

.quick-entry-overview {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #f8fafb;
}

.quick-entry-stat {
    min-width: 0;
    padding: .75rem .9rem;
    border-left: 1px solid var(--app-border);
}

.quick-entry-stat:last-child {
    border-left: 0;
}

.quick-entry-stat strong,
.quick-entry-stat span {
    display: block;
}

.quick-entry-stat strong {
    color: var(--app-primary-dark);
    font-size: 1.05rem;
}

.quick-entry-stat span {
    margin-top: .18rem;
    overflow: hidden;
    color: var(--app-muted);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-save-bar {
    position: sticky;
    bottom: .75rem;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    border: 1px solid #c9dbd8;
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px rgba(24, 53, 61, .12);
    backdrop-filter: blur(8px);
}

.relation-entry-panel {
    padding: 1rem;
    background: #f8fafb;
    border: 1px solid var(--app-border);
    border-radius: 14px;
}

.weekly-network-filters {
    position: relative;
    z-index: 5;
}

.weekly-filter-scroll {
    overflow-x: auto;
    padding-bottom: .25rem;
    scrollbar-width: thin;
}

.weekly-filter-grid {
    display: grid;
    grid-template-columns:
        minmax(190px, 1.3fr)
        repeat(6, minmax(142px, 1fr))
        minmax(138px, .8fr)
        minmax(118px, .65fr);
    gap: .75rem;
    align-items: end;
    min-width: 1390px;
}

.weekly-filter-control {
    min-width: 0;
}

.weekly-filter-control .form-label {
    overflow: hidden;
    margin-bottom: .35rem;
    font-size: .76rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-filter-control .form-control,
.weekly-filter-control .form-select {
    min-height: 40px;
    font-size: .85rem;
}

.weekly-filter-confidence .form-range {
    min-height: 40px;
    margin: 0;
}

.weekly-filter-switch {
    display: flex;
    min-height: 40px;
    align-items: center;
    margin: 0;
    gap: .35rem;
    white-space: nowrap;
}

@media (min-width: 1600px) {
    .weekly-filter-grid {
        min-width: 0;
    }
}

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem 1rem;
    color: var(--app-muted);
    font-size: .75rem;
}

.matrix-legend span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-dot.allocation { background: #c9912f; }
.legend-dot.confirmed { background: #1a8a7d; }
.legend-dot.likely { background: #528ab9; }
.legend-dot.possible { background: #9aa7ad; }
.legend-dot.absent { background: #c95b50; }
.legend-dot.unknown {
    background: #fff;
    border: 1px solid #9aa7ad;
}

.legend-bar {
    width: 18px;
    height: 4px;
    border-radius: 999px;
    background: #9aa7ad;
}

.legend-bar.our-allocation { background: #c9912f; }
.legend-bar.negotiation { background: #0f6b64; }
.legend-bar.other-lot { background: #9aa7ad; }

.graph-demand-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem 1rem;
    color: var(--app-muted);
    font-size: .75rem;
}

.graph-demand-legend span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.company-group-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--company-group-color);
    border-radius: 4px;
    background: color-mix(in srgb, var(--company-group-color) 14%, white);
}

.matrix-company-group {
    display: block;
    width: fit-content;
    margin-top: .35rem;
    padding: .15rem .4rem;
    border: 1px solid var(--company-group-color);
    border-radius: 999px;
    color: var(--company-group-color);
    font-size: .62rem;
    font-weight: 700;
}

.matrix-company-column .behavior-badge {
    display: inline;
    margin-top: 0;
    margin-inline-start: .2rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    font-size: .62rem;
}

.legend-line {
    display: inline-block;
    width: 24px;
    border-top: 2px solid #178276;
}

.legend-line.allocation {
    border-color: #c9912f;
    border-top-width: 3px;
}

.legend-line.anonymous {
    border-color: #6f7fc4;
    border-top-style: dashed;
}

.legend-line.unknown-total {
    border-color: #9aa7ad;
    border-top-style: dotted;
}

.legend-box {
    display: inline-block;
    width: 24px;
    height: 14px;
    border: 2px solid #5f6fb2;
    border-radius: 4px;
}

.legend-box.dashed {
    border-color: #d45a45;
    border-style: dashed;
}

.weekly-matrix-scroll {
    overflow: auto;
    max-height: 660px;
}

.weekly-relation-matrix {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.weekly-relation-matrix th,
.weekly-relation-matrix td {
    border-left: 1px solid var(--app-border);
    border-bottom: 1px solid var(--app-border);
}

.weekly-relation-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    min-width: 92px;
    text-align: center;
}

.weekly-relation-matrix .matrix-company-column {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 175px;
    max-width: 175px;
    background: #fff;
    text-align: right;
    box-shadow: -7px 0 12px rgba(24, 53, 61, .04);
}

.weekly-relation-matrix thead .matrix-company-column {
    z-index: 4;
    background: #f8fafb;
}

.matrix-company-group-heading th {
    padding: .42rem .75rem;
    border-right: 4px solid var(--matrix-company-group-color);
    background: color-mix(in srgb, var(--matrix-company-group-color) 8%, white);
    color: var(--matrix-company-group-color);
    font-size: .72rem;
    font-weight: 800;
    text-align: right;
}

.matrix-company-group-heading span {
    display: inline-flex;
    margin-inline-start: .45rem;
    padding: .08rem .35rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .58rem;
}

.matrix-lot-column span,
.matrix-lot-column small {
    display: block;
}

.matrix-lot-column .matrix-offer-code {
    color: var(--app-primary-dark);
    direction: ltr;
    font-weight: 700;
}

.matrix-lot-group-marker {
    display: block;
    width: 26px;
    height: 4px;
    margin: .35rem auto 0;
    border-radius: 999px;
    background: #9aa7ad;
}

.matrix-lot-column[data-group="our_allocation"] .matrix-lot-group-marker {
    background: #c9912f;
}

.matrix-lot-column[data-group="our_external_entry"] .matrix-lot-group-marker {
    background: #0f6b64;
}

.matrix-lot-column[data-group="other"] .matrix-lot-group-marker {
    background: #9aa7ad;
}

.matrix-lot-column .decision-badge {
    display: inline-flex;
    margin-inline: auto;
}

.matrix-lot-column small {
    margin-top: .3rem;
    color: var(--app-muted);
    font-size: .65rem;
    font-weight: 400;
}

.matrix-relation-cell {
    position: relative;
    height: 64px;
    min-width: 92px;
    text-align: center;
    vertical-align: middle;
    transition: opacity .15s ease, filter .15s ease;
}

.matrix-relation-cell .relation-mark {
    display: block;
    color: var(--matrix-relation-color, var(--app-muted));
    font-size: 1.1rem;
    line-height: 1;
}

.matrix-relation-cell small {
    display: block;
    margin-top: .3rem;
    color: var(--matrix-relation-color, var(--app-muted));
    font-size: .65rem;
}

.matrix-relation-cell.relation-confirmed { --matrix-relation-color: #1a8a7d; }
.matrix-relation-cell.relation-likely { --matrix-relation-color: #528ab9; }
.matrix-relation-cell.relation-possible { --matrix-relation-color: #7f8d94; }
.matrix-relation-cell.relation-absent { --matrix-relation-color: #c95b50; }
.matrix-relation-cell.relation-unknown { --matrix-relation-color: #89969d; }

.allocation-mark {
    position: absolute;
    top: 5px;
    left: 5px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #c9912f;
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
}

.relation-filtered-out {
    opacity: .14;
    filter: grayscale(1);
}

.weekly-network-graph {
    min-height: 520px;
    overflow: auto;
    background:
        linear-gradient(90deg, rgba(15, 107, 100, .025) 0 29%, transparent 29% 71%, rgba(201, 145, 47, .025) 71%);
}

.network-column-title {
    fill: var(--app-muted);
    font-family: var(--app-font);
    font-size: 14px;
    font-weight: 700;
}

.network-edge {
    fill: none;
    stroke: #98a7ad;
    stroke-width: 1.8;
    opacity: .7;
    transition: opacity .15s ease, stroke-width .15s ease;
}

.network-edge.edge-allocation { stroke: #c9912f; stroke-width: 3; }
.network-edge.edge-confirmed { stroke: #178276; stroke-width: 2.6; }
.network-edge.edge-likely { stroke: #528ab9; stroke-dasharray: 7 4; }
.network-edge.edge-possible { stroke: #97a5ab; stroke-dasharray: 3 5; }
.network-edge.edge-unknown { stroke: #bcc6ca; stroke-dasharray: 2 7; }
.network-edge.edge-absent { stroke: #c95b50; stroke-dasharray: 8 5; opacity: .45; }

.network-anonymous-stubs {
    opacity: .9;
    transition: opacity .15s ease;
}

.network-anonymous-stubs path {
    fill: none;
    stroke: #6f7fc4;
    stroke-width: 2.2;
    stroke-dasharray: 5 4;
    pointer-events: stroke;
    transition: stroke-width .15s ease;
}

.network-anonymous-stubs.unknown-total path {
    stroke: #9aa7ad;
    stroke-dasharray: 2 7;
}

.network-anonymous-stubs text {
    fill: #6677b8;
    font-family: var(--app-font);
    font-size: 11px;
    font-weight: 800;
    pointer-events: none;
}

.network-anonymous-stubs.unknown-total text {
    fill: #7d8b91;
}

.network-node {
    cursor: pointer;
    outline: none;
    transition: opacity .15s ease;
}

.network-node rect {
    fill: #fff;
    stroke: #b9c7cb;
    stroke-width: 1.3;
    filter: drop-shadow(0 3px 5px rgba(24, 53, 61, .08));
}

.network-company-group {
    cursor: pointer;
    opacity: .9;
    transition: opacity .15s ease;
}

.network-behavior-group {
    cursor: pointer;
    opacity: .9;
    transition: opacity .15s ease;
}

.network-behavior-group rect {
    fill: var(--behavior-group-color);
    fill-opacity: .025;
    stroke: var(--behavior-group-color);
    stroke-width: 1.8;
    stroke-dasharray: 9 6;
    transition: fill-opacity .15s ease, stroke-width .15s ease;
}

.network-behavior-group text {
    fill: var(--behavior-group-color);
    font-family: var(--app-font);
    font-size: 12px;
    font-weight: 800;
    pointer-events: none;
}

.network-behavior-group:focus rect,
.network-behavior-group:hover rect,
.network-behavior-group.is-selected rect {
    fill-opacity: .1;
    stroke-width: 3;
}

.network-behavior-group.is-partially-selected rect {
    fill-opacity: .065;
    stroke-width: 2.5;
}

.network-company-group rect {
    fill: var(--company-group-color);
    fill-opacity: .055;
    stroke: var(--company-group-color);
    stroke-width: 1.8;
    stroke-dasharray: none;
    transition: fill-opacity .15s ease, stroke-width .15s ease;
}

.network-company-group text {
    fill: var(--company-group-color);
    font-family: var(--app-font);
    font-size: 12px;
    font-weight: 800;
    pointer-events: none;
}

.network-company-group.is-our-group rect {
    fill-opacity: .09;
    stroke-width: 2.4;
    stroke-dasharray: none;
}

.network-company-group:focus rect,
.network-company-group:hover rect,
.network-company-group.is-selected rect {
    fill-opacity: .16;
    stroke-width: 3.2;
}

.network-company-group.is-partially-selected rect {
    fill-opacity: .11;
    stroke-width: 2.6;
}

.network-lot-group {
    cursor: pointer;
    pointer-events: auto;
    opacity: .9;
    transition: opacity .15s ease;
}

.network-lot-group rect {
    fill: var(--lot-group-color);
    fill-opacity: .055;
    stroke: var(--lot-group-color);
    stroke-width: 1.8;
    stroke-dasharray: none;
    transition: fill-opacity .15s ease, stroke-width .15s ease;
}

.network-lot-group text {
    fill: var(--lot-group-color);
    font-family: var(--app-font);
    font-size: 11.5px;
    font-weight: 800;
    pointer-events: none;
}

.network-lot-group:focus rect,
.network-lot-group:hover rect,
.network-lot-group.is-selected rect {
    fill-opacity: .16;
    stroke-width: 3.2;
}

.network-lot-group.is-partially-selected rect {
    fill-opacity: .11;
    stroke-width: 2.6;
}

.network-node text {
    fill: var(--app-ink);
    font-family: var(--app-font);
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

.network-company-node rect { fill: #eef7f5; stroke: #7fb4ae; }
.network-lot-node rect {
    fill: var(--lot-node-fill);
    stroke: var(--lot-node-stroke);
}

.network-lot-node .network-lot-status {
    fill: #53636b;
    font-size: 10.5px;
    font-weight: 800;
}

.network-lot-node.decision-base_price rect,
.network-lot-node.decision-competing rect,
.network-lot-node.decision-won rect {
    stroke-width: 2.7;
}

.network-lot-node.decision-withdrawn {
    opacity: .48;
}

.network-lot-node.decision-withdrawn > text:not(.network-lot-status) {
    text-decoration: line-through;
}

.network-node:focus rect,
.network-node:hover rect,
.network-node.is-selected rect { stroke-width: 3; }
.network-node.is-connected {
    opacity: .52;
}
.network-node.is-connected rect {
    stroke-width: 2;
}
.network-edge.is-selected { opacity: 1; stroke-width: 4; }
.network-anonymous-stubs.is-selected { opacity: 1; }
.network-anonymous-stubs.is-selected path { stroke-width: 3.5; }
.network-node.is-dimmed,
.network-edge.is-dimmed,
.network-anonymous-stubs.is-dimmed,
.network-company-group.is-dimmed,
.network-behavior-group.is-dimmed,
.network-lot-group.is-dimmed { opacity: .08; }

@media (min-width: 1200px) {
    .weekly-matrix-scroll {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .weekly-relation-matrix {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .weekly-relation-matrix th,
    .weekly-relation-matrix td {
        padding-right: .15rem;
        padding-left: .15rem;
    }

    .weekly-relation-matrix thead th,
    .weekly-relation-matrix .matrix-relation-cell {
        min-width: 0;
    }

    .weekly-relation-matrix .matrix-company-column {
        width: 128px;
        min-width: 128px;
        max-width: 128px;
        padding-right: .4rem;
        padding-left: .4rem;
        font-size: .7rem;
    }

    .matrix-lot-column {
        padding-top: .5rem !important;
        padding-bottom: .45rem !important;
        overflow-wrap: break-word;
    }

    .matrix-lot-column > span[dir="ltr"] {
        font-size: .72rem;
        line-height: 1.1;
    }

    .matrix-lot-column small {
        font-size: .55rem;
        line-height: 1.25;
    }

    .matrix-lot-column .decision-badge {
        max-width: 100%;
        justify-content: center;
        padding: .1rem .2rem;
        font-size: .5rem;
        line-height: 1.15;
        white-space: normal;
    }

    .matrix-lot-group-marker {
        width: min(26px, 62%);
        height: 3px;
        margin-top: .3rem;
    }

    .matrix-relation-cell {
        height: 56px;
        padding-top: .2rem !important;
        padding-bottom: .2rem !important;
    }

    .matrix-relation-cell .relation-mark {
        font-size: .95rem;
    }

    .matrix-relation-cell small {
        margin-top: .2rem;
        font-size: .55rem;
    }

    .allocation-mark {
        top: 3px;
        left: 3px;
        width: 16px;
        height: 16px;
        font-size: .55rem;
    }
}

@media (max-width: 767px) {
    .data-entry-steps a {
        flex: 1 1 100%;
    }

    .quick-entry-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-entry-stat:nth-child(even) {
        border-left: 0;
    }

    .quick-entry-stat:nth-child(-n+4) {
        border-bottom: 1px solid var(--app-border);
    }

    .weekly-save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .weekly-save-bar .btn {
        width: 100%;
    }

    .weekly-relation-matrix .matrix-company-column {
        min-width: 145px;
        max-width: 145px;
    }
}
