:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e5e7eb;
    --success: #059669;
    --error: #dc2626;
    --warning: #d97706;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background: #C7D4E3;
    color: var(--text);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #AAB9CB;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.app-layout {
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.product-sidebar {
    position: sticky;
    top: 1rem;
}

.product-nav {
    display: grid;
    gap: 1rem;
    padding: 0.85rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.nav-group {
    display: grid;
    gap: 0.2rem;
}

.nav-group--workspace {
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

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

.product-nav a {
    display: block;
}

.workspace-home-link {
    color: var(--primary) !important;
}

.environment-marker {
    margin: 0;
    padding: 0.25rem 0.6rem;
    border: 1px solid #9a6700;
    border-radius: 999px;
    background: #fff3cd;
    color: #7a4b00;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.source-test-blocked {
    color: #7a4b00;
    font-weight: 600;
}

.logo a {
    color: #243447;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav a {
    color: #243447;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

.nav a:hover,
.nav a.active {
    color: #FFFFFF;
    background: #315F8C;
    text-decoration: none;
}

.main {
    padding-bottom: 2rem;
}

.home-empty-area {
    min-height: clamp(28rem, calc(100vh - 11rem), 48rem);
    border: 1px solid #a9c8e0;
    border-radius: 10px;
    background: linear-gradient(135deg, #dceefa, #b9dbf2);
}

.directions-intro p {
    margin: 0.25rem 0;
}

.direction-matrix-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.direction-matrix {
    min-width: 1100px;
    margin: 0;
}

.direction-matrix th {
    white-space: normal;
    vertical-align: top;
}

.direction-matrix td {
    min-width: 110px;
    text-align: center;
}

.direction-source-name {
    min-width: 190px;
    text-align: left;
}

.direction-status {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.direction-status--suitable {
    background: #d1fae5;
    color: #065f46;
}

.direction-status--limited {
    background: #fff4d6;
    color: #7a4b00;
}

.credit-help {
    position: relative;
    display: inline-block;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.credit-help summary,
.credit-question {
    display: inline-grid;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border: 1px solid #6b7280;
    border-radius: 50%;
    color: #374151;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    list-style: none;
}

.credit-help summary::-webkit-details-marker {
    display: none;
}

.credit-help-popup {
    position: absolute;
    z-index: 2;
    top: 1.6rem;
    left: 0;
    width: min(290px, 72vw);
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(31, 41, 55, 0.15);
    text-align: left;
    font-size: 0.85rem;
    font-weight: 400;
}

.credit-help-popup p {
    margin: 0.35rem 0 0;
}

.page-header {
    margin-bottom: 1rem;
}

.page-header h2 {
    margin: 0 0 0.25rem;
}

.muted {
    color: var(--muted);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

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

.form-grid label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
}

.form-grid-full { grid-column: 1 / -1; }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid-full { grid-column: auto; }
    .app-layout { display: block; }
    .product-sidebar { position: static; margin-bottom: 1rem; }
    .product-nav { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .nav-group--workspace { padding-top: 0; border-top: 0; border-left: 1px solid var(--border); padding-left: 0.75rem; }
    .home-links { grid-template-columns: 1fr; }
}

.test-mode-banner {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    border: 1px solid #b45309;
    border-radius: 8px;
    background: #fef3c7;
    color: #78350f;
    font-weight: 600;
}

.source-status-banner {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    border: 1px solid #AAB9CB;
    border-radius: 8px;
    color: #243447;
    background: #E8F0F7;
}

.source-status-banner--warning {
    border-color: #E3C46E;
    background: #FFF4D6;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
}

.btn-secondary {
    background: #6b7280;
}

.btn-warning {
    background: var(--warning);
}

.btn-small {
    padding: 0.35rem 0.7rem;
}

/* The .btn display rule otherwise overrides the native hidden attribute. */
#manual-assessment-form [hidden] {
    display: none !important;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.current-work-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.order-card h3 {
    margin: 0;
}

.source-tag {
    background: #eef2ff;
    color: #3730a3;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.order-scores {
    margin: 0.75rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.score-main {
    font-weight: 700;
}

.score-fin { }

.order-meta,
.order-status-line,
.order-event-line {
    margin: 0.35rem 0;
}

.order-actions {
    margin-top: 0.75rem;
}

.work-card-details {
    display: grid;
    gap: 0.45rem;
    margin: 0.85rem 0;
}

.work-card-details div {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 0.65rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}

.work-card-details dt {
    font-weight: 700;
}

.work-card-details dd {
    margin: 0;
    text-align: right;
}

.current-work-card .order-card-header {
    display: block;
}

.current-work-offer-meta {
    margin: 0 0 0.35rem;
    color: #254f7b;
    font-weight: 700;
}

.current-work-card .order-card-header h3 {
    margin: 0;
}

.current-work-card .work-card-details div {
    grid-template-columns: minmax(190px, 1.3fr) minmax(0, 1fr);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
}

.actions-cell {
    white-space: nowrap;
}

.inline-form {
    display: inline-block;
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
}

.settings-form {
    display: grid;
    gap: 1rem;
    max-width: 420px;
}

.settings-form label {
    display: grid;
    gap: 0.35rem;
    font-weight: 500;
}

.settings-form input,
.settings-form select,
.close-form select,
.close-form input,
.reject-form input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.meta-grid dt {
    color: var(--muted);
}

.meta-grid dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-list dt {
    font-weight: 600;
    margin-top: 0.75rem;
}

.detail-list dd {
    margin: 0.25rem 0 0;
}

.breakdown-list {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
}

.score-block {
    margin-bottom: 1rem;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.score-total {
    font-weight: 700;
}

.recommendation {
    margin-top: 1rem;
}

.response-text {
    display: block;
    width: 100%;
    min-height: 360px;
    box-sizing: border-box;
    resize: vertical;
    white-space: pre-wrap;
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
}

.how-to-quickstart {
    margin-bottom: 1rem;
}

.how-to-quickstart ol {
    margin: 0.75rem 0 0;
    padding-left: 1.35rem;
}

.how-to-quickstart li + li {
    margin-top: 0.45rem;
}

.how-to-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.how-to-section h3,
.support-card h3 {
    margin-top: 0;
}

.how-to-section p:last-child,
.support-card p:last-of-type {
    margin-bottom: 0;
}

.how-to-steps {
    margin: 0.85rem 0 0;
    padding-left: 1.35rem;
}

.how-to-steps li + li {
    margin-top: 0.9rem;
}

.how-to-steps li p {
    margin: 0.3rem 0 0;
}

.support-card {
    margin-top: 1rem;
    border-color: #b9d8d1;
    background: #f5fbf9;
}

.response-editor-form > label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.response-editor {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
}

.response-editor form,
.response-editor label {
    display: block;
    width: 100%;
    max-width: none;
}

.response-editor textarea {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 360px;
    box-sizing: border-box;
    resize: vertical;
}

.response-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
}

.manual-send-hint {
    flex-basis: 100%;
    margin: 0;
    color: var(--muted);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.close-form,
.reject-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.timeline-list time {
    display: block;
    color: var(--muted);
}

.timeline-last-event {
    margin: 0 0 0.75rem;
}

.timeline-last-event time {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
}

.timeline-toggle {
    display: inline-flex;
    cursor: pointer;
    list-style: none;
}

.timeline-toggle::-webkit-details-marker {
    display: none;
}

.timeline-hide-label {
    display: none;
}

.timeline-details[open] .timeline-show-label {
    display: none;
}

.timeline-details[open] .timeline-hide-label {
    display: inline;
}

.timeline-details .timeline-list {
    margin-top: 0.75rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
}

.warning {
    color: var(--warning);
    margin-top: 0.75rem;
}

.search-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.results-section h3 {
    margin-bottom: 0.75rem;
}

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

.search-runs-toggle {
    display: inline-flex;
    cursor: pointer;
    list-style: none;
}

.search-runs-toggle::-webkit-details-marker {
    display: none;
}

.search-runs-hide-label {
    display: none;
}

.search-runs-details[open] .search-runs-show-label {
    display: none;
}

.search-runs-details[open] .search-runs-hide-label {
    display: inline;
}

.search-runs-table {
    margin-top: 0.75rem;
}

.search-runs-more {
    margin-top: 0.75rem;
}

.profile-form fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0 0 1rem;
    padding: 1rem;
}

.profile-form legend {
    font-weight: 600;
    padding: 0 0.25rem;
}

.profile-list {
    margin-top: 0;
}

.profile-repeatable {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-row input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.vacancy-settings .vacancy-option {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    width: fit-content;
    margin: 0.25rem 0;
}

.vacancy-settings .vacancy-option input[type="checkbox"] {
    width: auto;
    min-width: 1rem;
    height: 1rem;
    margin: 0;
    padding: 0;
}

.profile-row select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

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

.catalog-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem;
}

.catalog-checks label {
    display: block;
}

.profile-financial-fields {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 1rem 0;
    padding: 0.75rem;
}

.profile-financial-fields legend {
    font-weight: 600;
    padding: 0 0.25rem;
}

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

.profile-financial-grid label {
    display: grid;
    gap: 0.35rem;
}

.profile-financial-grid input {
    min-width: 0;
    padding: 0.5rem;
}

#specializations-list label[hidden] {
    display: none !important;
}

.profile-skill-picker {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.profile-skill-picker input,
.profile-skill-picker select {
    min-width: 0;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.profile-skill-picker input,
.profile-skill-picker select:first-child {
    flex: 1;
}

.empty-profile-message {
    margin: 0 0 1rem;
    font-weight: 600;
}

.score-explanation {
    color: var(--muted);
    margin-left: 0.25rem;
}

.score-excluded {
    color: var(--error);
    font-weight: 600;
}

.source-filter-bar,
.source-region-tabs,
.source-state-tabs,
.source-registry-summary {
    display: flex;
    gap: 0.6rem;
}

.source-region-tabs {
    gap: 0.4rem;
}

.source-filter-bar {
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}

.source-state-tabs {
    display: flex;
    gap: 0.4rem;
}

.source-registry-summary {
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.source-registry-summary span {
    color: var(--muted);
}

.source-table-card {
    padding: 0;
    overflow: hidden;
}

.source-table {
    margin: 0;
}

.source-table th,
.source-table td {
    padding: 0.6rem 0.7rem;
    vertical-align: middle;
}

.source-table th {
    white-space: nowrap;
}

.source-actions-cell {
    white-space: nowrap;
}

.source-details-row td {
    padding: 0.75rem 1rem;
    background: #f8fafc;
}

.source-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem 1rem;
}

.source-detail-explanation {
    grid-column: 1 / -1;
}

@media (max-width: 600px) {
    .profile-row {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .profile-row input {
        flex-basis: 100%;
    }

    .profile-skill-picker {
        flex-wrap: wrap;
    }

    .profile-skill-picker input,
    .profile-skill-picker select:first-child {
        flex-basis: 100%;
    }

    .source-filter-bar,
    .source-region-tabs,
    .source-state-tabs {
        width: 100%;
        flex-wrap: wrap;
    }

    .source-filter-bar .btn {
        padding: 0.4rem 0.65rem;
    }

    .source-table-card {
        border: 0;
        background: transparent;
        overflow: visible;
    }

    .source-table,
    .source-table tbody,
    .source-table tr,
    .source-table td {
        display: block;
        width: 100%;
    }

    .source-table thead {
        display: none;
    }

    .source-table-row {
        margin: 0 0 0.45rem;
        padding: 0.55rem 0.75rem;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 8px;
    }

    .source-table td {
        padding: 0.25rem 0;
        border: 0;
    }

    .source-table td[data-label]:not(.source-title-cell):not(.source-actions-cell) {
        display: grid;
        grid-template-columns: 105px minmax(0, 1fr);
        gap: 0.5rem;
    }

    .source-table td[data-label]:not(.source-title-cell):not(.source-actions-cell)::before {
        content: attr(data-label);
        color: var(--muted);
    }

    .source-actions-cell {
        display: flex !important;
        align-items: center;
        gap: 0.4rem;
        margin-top: 0.35rem;
    }

    .source-details-row {
        margin: -0.25rem 0 0.55rem;
    }

    .source-details-row td {
        padding: 0.75rem;
        border: 1px solid var(--border);
        border-radius: 0 0 8px 8px;
    }

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

    .source-detail-explanation {
        grid-column: auto;
    }
}

/* Final visual pass: shared contrast, rhythm and responsive component rules. */
:root {
    --bg: #e8eef5;
    --card: #ffffff;
    --text: #17283a;
    --muted: #506276;
    --primary: #1f5f99;
    --primary-hover: #174b7b;
    --border: #c9d5e2;
    --success: #087f5b;
    --error: #b42318;
    --warning: #a65d08;
    --focus: #0d78bd;
    --radius: 8px;
    --space-1: 0.35rem;
    --space-2: 0.6rem;
    --space-3: 0.9rem;
    --space-4: 1.25rem;
    --space-5: 1.75rem;
}

html { background: var(--bg); }

body {
    min-width: 0;
    font-family: "Segoe UI", Roboto, Arial, system-ui, sans-serif;
    line-height: 1.55;
    letter-spacing: 0.002em;
}

body, button, input, select, textarea { color: var(--text); }

a { text-underline-offset: 0.16em; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
    outline-offset: 2px;
}

.container {
    max-width: 1180px;
    padding-left: clamp(1rem, 2.8vw, 2rem);
    padding-right: clamp(1rem, 2.8vw, 2rem);
}

.header {
    background: #d5e0eb;
    border-bottom-color: #aebfd0;
    box-shadow: 0 1px 0 rgba(23, 40, 58, 0.08);
    padding: var(--space-3) 0;
    margin-bottom: var(--space-5);
}

.header-inner { gap: var(--space-3) var(--space-4); flex-wrap: nowrap; }
.logo { margin: 0; line-height: 1.05; flex: 0 0 auto; }
.logo a { display: inline-flex; align-items: baseline; gap: 0.42rem; color: #173b5c; }
.brand-name { font-weight: 750; letter-spacing: -0.025em; }
.brand-context { color: #425e78; font-weight: 600; letter-spacing: 0; }

.nav { justify-content: flex-end; gap: 0.35rem; }
.nav a { color: #284963; padding: 0.52rem 0.68rem; border-radius: 6px; }
.nav a:hover, .nav a.active { background: var(--primary); color: #fff; box-shadow: none; }
.nav-toggle { display: none; }

.main { padding-bottom: 3rem; }
.page-header { margin: 0 0 var(--space-4); }
.page-header h2 { color: #18344f; font-weight: 700; line-height: 1.22; margin-bottom: var(--space-1); }
h3 { color: #1a3855; line-height: 1.3; }
h4 { color: #27435e; }
.muted { color: var(--muted); }

.card {
    border-color: var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(23, 40, 58, 0.045);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

.flash, .source-status-banner, .test-mode-banner {
    border-radius: var(--radius);
    border-width: 1px;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.78rem 1rem;
    font-weight: 600;
}
.flash::before, .source-status-banner::before, .test-mode-banner::before { font-weight: 800; line-height: 1.45; }
.flash-success { background: #e4f5ee; border-color: #91cfb9; color: #075c43; }
.flash-success::before { content: "✓"; }
.flash-error { background: #fcedeb; border-color: #e4aaa5; color: #922018; }
.flash-error::before { content: "!"; }
.source-status-banner { background: #e8f1f8; border-color: #a9c4da; color: #254963; }
.source-status-banner--warning { background: #fff4dd; border-color: #ddbd72; color: #75500b; }
.test-mode-banner::before { content: "!"; }

.btn {
    min-height: 2.6rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 650;
    line-height: 1.25;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-primary, .btn { background: var(--primary); }
.btn:hover, .btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #53687d; }
.btn-secondary:hover { background: #405568; }
.btn-warning { background: #a96308; }
.btn-small { min-height: 2.2rem; padding: 0.4rem 0.66rem; }
.btn:disabled { opacity: 0.58; cursor: not-allowed; filter: saturate(0.55); }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    max-width: 100%;
    min-height: 2.6rem;
    border-color: #b9c8d7;
    border-radius: 6px;
    background: #fff;
    padding: 0.52rem 0.62rem;
    font: inherit;
}
textarea { min-height: 7rem; line-height: 1.5; }
input[type="file"] { padding: 0.38rem; }
label { color: #29435b; }

.order-grid, .stats-grid, .how-to-grid { gap: var(--space-3); }
.order-card h3 { line-height: 1.35; }
.order-card-header { padding-bottom: 0.6rem; border-bottom: 1px solid #dbe4ed; }
.source-tag { background: #dfeaf5; color: #254f7b; border: 1px solid #bfd0e1; font-weight: 650; }
.order-meta, .order-status-line, .order-event-line { }
.score-main { color: #173f67; }

.data-table { }
.data-table th, .data-table td { border-bottom-color: #d4dee8; padding: 0.72rem 0.6rem; }
.data-table th { color: #40566d; font-weight: 750; background: #f4f8fb; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--border); border-radius: 6px; }
.table-scroll .data-table { margin: 0; }
.search-runs-details { max-width: 100%; overflow-x: auto; }

.empty-state { padding: 2.25rem 1.25rem; color: #40566d; }
.empty-state::before { content: "—"; display: block; color: var(--primary); font-weight: 700; }
.status-panel { border-left: 4px solid #78a3c8; }
.warning { font-weight: 600; }
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid #b8c8d7;
    border-radius: 999px;
    background: #eef4f8;
    color: #284963;
    font-weight: 700;
    line-height: 1.25;
}
.badge-completed, .badge-closed_completed { background: #e4f5ee; border-color: #91cfb9; color: #075c43; }
.badge-rejected, .badge-closed_rejected, .badge-customer_declined, .badge-our_declined { background: #fcedeb; border-color: #e4aaa5; color: #922018; }
.badge-in_work, .badge-negotiations, .badge-interviewing { background: #e8f1f8; border-color: #a9c4da; color: #254963; }

.card, .data-table td, .source-detail-explanation { overflow-wrap: anywhere; }

@media (max-width: 1279px) {
    .header-inner { align-items: flex-start; }
    .nav { gap: 0.22rem; }
    .nav a { padding-inline: 0.52rem; }
}

@media (max-width: 1023px) {
    .container { max-width: 960px; }
    .header { margin-bottom: var(--space-4); }
    .detail-grid { gap: var(--space-3); }
}

@media (min-width: 900px) and (max-width: 1100px) {
    .header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: 0.42rem 0.7rem; color: #1d3e5b; border: 1px solid #9bb4ca; border-radius: 6px; background: #edf4fa; font: inherit; font-weight: 700; }
    .nav { display: none; grid-column: 1 / -1; width: 100%; padding-top: 0.5rem; flex-direction: column; align-items: stretch; }
    .nav.is-open { display: flex; }
    .nav a { padding: 0.62rem 0.75rem; }
}

@media (max-width: 899px) {
    body { overflow-x: hidden; }
    .container { padding-left: 0.9rem; padding-right: 0.9rem; }
    .header { padding: 0.72rem 0; margin-bottom: 1.1rem; }
    .header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    .brand-name { }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: 0.42rem 0.7rem; color: #1d3e5b; border: 1px solid #9bb4ca; border-radius: 6px; background: #edf4fa; font: inherit; font-weight: 700; }
    .nav { display: none; grid-column: 1 / -1; width: 100%; padding-top: 0.5rem; flex-direction: column; align-items: stretch; }
    .nav.is-open { display: flex; }
    .nav a { padding: 0.65rem 0.75rem; }
    .main { padding-bottom: 2rem; }
    .page-header { margin-bottom: 1rem; }
    .page-header h2 { }
    .card { padding: 1rem; border-radius: 7px; }
    .form-grid, .detail-grid, .profile-financial-grid { grid-template-columns: 1fr; }
    .form-grid-full { grid-column: auto; }
    .profile-actions, .response-controls, .action-buttons { align-items: stretch; flex-direction: column; }
    .profile-actions .btn, .response-controls .btn, .action-buttons .btn, .action-buttons .inline-form { width: 100%; }
    .action-buttons .inline-form { margin: 0; }
    .order-grid, .stats-grid, .how-to-grid { grid-template-columns: 1fr; }
    .order-card-header { flex-wrap: wrap; }
    .work-card-details div { grid-template-columns: 1fr; gap: 0.15rem; }
    .current-work-card .work-card-details div { grid-template-columns: 1fr; }
    .work-card-details dd { text-align: left; }
    .source-tag { white-space: normal; }
    .data-table { min-width: 640px; }
    .card:has(> .data-table) { overflow-x: auto; }
    .table-scroll .data-table { min-width: 640px; }
    .response-editor textarea { min-height: 15rem; }
    .profile-skill-picker { align-items: stretch; }
    .profile-skill-picker .btn { min-height: 2.5rem; }
    .source-table { min-width: 0; }
}

/* Approved Home shell: a clear product heading, one roomy sidebar, and an
   intentionally empty calm Home canvas.  These rules follow earlier visual
   refinements so the shared layout stays predictable on every page. */
.header {
    padding: 1rem 0;
    background: #DCECF8;
}

.header .container {
    max-width: 1320px;
}

.app-layout.container {
    max-width: 1320px;
}

.header-inner {
    display: grid;
    grid-template-columns: max-content auto minmax(3rem, 1fr);
    align-items: center;
    gap: 2rem;
}

.product-brand {
    justify-self: start;
    margin: 0;
    text-align: left;
}

.product-brand a {
    display: grid;
    gap: 0.1rem;
    color: #173b5c;
    text-decoration: none;
}

.product-title {
    font-size: clamp(1.45rem, 2.3vw, 2rem) !important;
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.product-subtitle {
    color: #47647e;
    font-size: 0.95rem !important;
    font-weight: 650;
    line-height: 1.2;
}

.environment-marker {
    justify-self: center;
    margin: 0;
}

.nav-toggle {
    justify-self: end;
}

.app-layout {
    grid-template-columns: minmax(300px, 320px) minmax(0, 1fr);
    gap: clamp(1rem, 1.6vw, 1.35rem);
}

.product-sidebar .product-nav {
    gap: 0;
    padding: 0.75rem;
}

.product-sidebar .nav-group {
    gap: 0.35rem;
}

.product-sidebar .product-nav a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 2.8rem;
    padding: 0.6rem 0.75rem;
    white-space: normal;
}

.home-empty-area {
    min-height: clamp(30rem, calc(100vh - 10rem), 52rem);
    border-color: #a7cbe5;
    background: linear-gradient(135deg, #e4f2fc 0%, #c7e3f5 100%);
}

@media (max-width: 899px) {
    .header-inner {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.75rem;
    }

    .environment-marker {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: start;
    }

    .product-brand {
        min-width: 0;
    }

    .product-title {
        font-size: 1.35rem !important;
    }
}

/* Product shell: this intentionally follows the older generic `.nav` rules
   so they cannot turn the single sidebar into a horizontal flex layout. */
.app-layout {
    display: grid;
    grid-template-columns: minmax(210px, 235px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(1rem, 3vw, 2rem);
}

.app-layout > .main {
    min-width: 0;
    width: 100%;
}

.product-sidebar .product-nav {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    width: 100%;
}

.product-sidebar .nav-group {
    min-width: 0;
}

@media (max-width: 899px) {
    .app-layout {
        display: block;
    }

    .product-sidebar {
        position: static;
        margin-bottom: 1rem;
    }

    .product-sidebar .product-nav {
        display: none;
        grid-template-columns: 1fr;
    }

    .product-sidebar .product-nav.is-open {
        display: grid;
    }
}

/* Final hierarchy correction: three deliberate text levels and a two-row header. */
:root {
    --font-brand: 32px;
    --font-major: 22px;
    --font-base: 16px;
}

body,
body * {
    font-size: var(--font-base) !important;
}

.header {
    padding: var(--space-4) 0 var(--space-3);
}

.header .container {
    max-width: 1180px;
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.brand-row {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
}

.logo {
    text-align: center;
}

.logo a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    color: #173b5c;
    text-decoration: none;
    white-space: nowrap;
}

.brand-name,
.brand-context {
    color: #173b5c;
    font-size: var(--font-brand) !important;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.page-header h2 {
    color: #18344f;
    font-size: var(--font-major) !important;
    font-weight: 700;
    line-height: 1.25;
}

h3,
h4,
.order-card h3,
.how-to-section h3,
.support-card h3 {
    font-size: var(--font-base) !important;
    font-weight: 700;
    line-height: 1.4;
}

.nav {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
}

.nav a,
.btn,
.btn-small {
    min-height: 2.7rem;
    padding: 0.52rem 0.75rem;
    font-size: var(--font-base) !important;
    font-weight: 700;
    line-height: 1.3;
}

.nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border: 1px solid transparent;
}

.nav a:hover,
.nav a.active {
    border-color: var(--primary);
}

.data-table,
.data-table th,
.data-table td,
.source-tag,
.badge,
.order-meta,
.order-status-line,
.order-event-line,
.score-explanation,
.manual-send-hint,
.timeline-list time,
.timeline-last-event time,
.meta-grid dt,
small {
    font-size: var(--font-base) !important;
}

.data-table th,
.source-table th {
    font-weight: 700;
}

.source-table th,
.source-table td {
    padding: 0.9rem 1rem;
}

.source-table a,
.source-table strong {
    font-weight: 700;
}

.empty-state {
    padding: var(--space-4);
}

.empty-state::before {
    font-size: var(--font-base);
}

.search-actions,
.manual-brief-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.search-actions h3,
.manual-brief-card h3 {
    margin: 0;
}

.search-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.search-actions form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: end;
}

.search-actions form label {
    display: grid;
    gap: var(--space-1);
    font-weight: 700;
}

.manual-brief-card .form-grid {
    gap: var(--space-2) var(--space-3);
}

.manual-brief-card textarea {
    height: 8rem;
    min-height: 8rem;
}

.source-status-banner::before {
    content: none;
    display: none;
}

@media (max-width: 1100px) {
    .header-inner {
        align-items: stretch;
    }

    .brand-row {
        justify-content: space-between;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 2.7rem;
        padding: 0.52rem 0.75rem;
        font-size: var(--font-base) !important;
        font-weight: 700;
    }

    .nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding-top: 0;
    }

    .nav.is-open {
        display: flex;
    }

    .nav a {
        justify-content: flex-start;
    }
}

@media (max-width: 899px) {
    :root {
        --font-brand: 28px;
        --font-major: 20px;
        --font-base: 16px;
    }

    .brand-row {
        gap: var(--space-2);
    }

    .logo {
        min-width: 0;
        text-align: left;
    }

    .logo a {
        flex-wrap: wrap;
        white-space: normal;
    }

    .search-actions form {
        grid-template-columns: 1fr;
    }

    .search-actions form .btn {
        width: 100%;
    }

    .manual-brief-card textarea {
        height: 7rem;
        min-height: 7rem;
    }
}

/* Final composition correction: hierarchy and density without changing product behaviour. */
:root {
    --font-brand: 32px;
    --font-major: 22px;
    --font-base: 16px;
}

.header .container {
    max-width: 1320px;
}

.nav a {
    min-height: 3rem;
    padding: 0.58rem 0.72rem;
    color: #254963;
    background: #edf4fa;
    border-color: #b6c8d9;
    font-size: var(--font-major) !important;
    font-weight: 700;
}

.nav a:hover {
    background: #dceaf5;
    border-color: #799ab8;
    color: #173b5c;
}

.nav a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-header h2 {
    font-size: var(--font-major) !important;
}

.btn,
.btn-small {
    min-height: 2.55rem;
    padding: 0.46rem 0.78rem;
}

.btn-danger-outline {
    background: #fff;
    border-color: #b42318;
    color: #922018;
}

.btn-danger-outline:hover {
    background: #fcedeb;
    border-color: #922018;
    color: #751713;
}

.search-actions {
    padding: var(--space-5);
    border-color: #aebfd0;
    box-shadow: 0 2px 4px rgba(23, 40, 58, 0.07);
}

.search-actions form {
    grid-template-columns: minmax(260px, 1fr) auto;
}

.manual-brief-card {
    padding: var(--space-3) var(--space-4);
}

.manual-brief-card .form-grid {
    gap: var(--space-2) var(--space-3);
}

.manual-brief-card textarea {
    height: 6.5rem;
    min-height: 6.5rem;
}

.search-run-summary .meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-2) var(--space-3);
}

.search-run-summary .meta-grid > div {
    min-width: 0;
}

.diagnostics-summary {
    margin: 0 0 var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.diagnostics-summary h4 {
    margin: 0 0 var(--space-2);
}

.diagnostics-summary p {
    margin: var(--space-1) 0;
}

.diagnostics-summary .btn {
    margin-top: var(--space-2);
}

.empty-state {
    min-height: 0;
    padding: var(--space-3) var(--space-4);
    text-align: left;
}

.empty-state::before {
    content: none;
    display: none;
}

.search-runs-history {
    padding: var(--space-3) var(--space-4);
}

.profile-direction-editor {
    display: grid;
    gap: var(--space-2);
}

.profile-direction-editor .profile-direction-title {
    margin: 0;
    font-weight: 750;
}

.profile-direction-editor .profile-subsection {
    margin: var(--space-2) 0 0;
    font-weight: 650;
}

.profile-skill-self-assessment {
    margin: var(--space-1) 0;
    color: #40566d;
    font-weight: 600;
}

.profile-skill-message + .muted {
    display: none;
}

.profile-skill-picker,
.skill-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, 14rem) auto;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

.profile-skill-picker input,
.profile-skill-picker select:first-child,
.skill-row input {
    min-width: 0;
}

.profile-skill-picker .catalog-level,
.profile-skill-picker .custom-level,
.skill-row .skill-level {
    width: 100%;
    min-width: 0;
}

.profile-skill-picker .btn,
.skill-row .btn {
    white-space: nowrap;
}

.catalog-checks {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-2) var(--space-3);
}

.source-registry-summary {
    display: inline-flex;
    width: auto;
    margin-bottom: var(--space-3);
    padding: 0.58rem 0.85rem;
}

.source-table th,
.source-table td {
    padding: 0.62rem 0.85rem;
}

.source-actions-cell .btn {
    min-height: 2.4rem;
    padding-block: 0.35rem;
}

.history-statistics > h3 {
    margin: 0 0 var(--space-2);
}

.history-statistics .stats-grid .card {
    min-height: 0;
    margin-bottom: 0;
    padding: var(--space-3) var(--space-4);
}

.history-statistics .stats-grid .card h4 {
    margin: 0 0 var(--space-1);
}

.history-statistics .stats-grid .card p {
    margin: var(--space-1) 0;
}

.history-statistics .inline-form {
    margin: 0 var(--space-2) 0 0;
}

.how-to-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.how-to-section {
    align-self: start;
}

@media (max-width: 1100px) {
    .header .container {
        max-width: 1180px;
    }

    .nav a {
        font-size: var(--font-base) !important;
    }
}

@media (max-width: 899px) {
    :root {
        --font-brand: 28px;
        --font-major: 20px;
        --font-base: 16px;
    }

    .search-actions {
        padding: var(--space-4);
    }

    .search-actions form,
    .profile-skill-picker,
    .skill-row,
    .how-to-grid {
        grid-template-columns: 1fr;
    }

    .profile-skill-picker .btn,
    .skill-row .btn {
        width: 100%;
    }

    .manual-brief-card textarea {
        height: 6rem;
        min-height: 6rem;
    }
}

/* Final search-form corrections: keep the automatic workflow primary. */
.search-actions {
    padding: calc(var(--space-5) + 0.25rem);
    border: 2px solid #799ab8;
    background: #f7fafc;
    box-shadow: 0 3px 7px rgba(23, 40, 58, 0.09);
}

.search-actions .search-type-tabs .btn,
.search-actions form .btn {
    min-height: 3rem;
}

.search-actions form {
    grid-template-columns: minmax(0, 1.25fr) minmax(13rem, 0.75fr);
}

.automatic-search-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.automatic-search-details-title {
    font-weight: 700;
}

.automatic-search-details-link {
    font-weight: 700;
}

.search-run-status {
    align-self: flex-start;
    margin: 0;
    padding: 0.35rem 0.65rem;
    border-radius: 0.35rem;
    font-weight: 700;
}

.search-run-status--completed {
    color: #14532d;
    background: #dcfce7;
}

.search-run-status--running {
    color: #1e3a5f;
    background: #dbeafe;
}

.search-run-status--error {
    color: #7f1d1d;
    background: #fee2e2;
}

.search-run-status--idle {
    color: #475569;
    background: #f1f5f9;
}

.previous-search-results {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border-left: 3px solid #799ab8;
    background: #f1f5f9;
    color: #334155;
}

.search-outcome-details .diagnostic-item {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
}

.search-outcome-details .diagnostic-item p {
    margin: 0.3rem 0;
}

.manual-brief-card {
    padding: var(--space-3);
}

.manual-offer-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem var(--space-3);
}

.manual-source-link,
.manual-order-text {
    grid-column: 1 / -1;
}

.manual-brief-card textarea {
    height: 6rem;
    min-height: 6rem;
}

.manual-attachment-field,
.manual-analysis-action {
    min-width: 0;
    align-self: end;
}

.manual-attachment-field input[type="file"] {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.2rem;
    border: 1px solid #b9c8d7;
    border-radius: 6px;
    background: #fff;
    color: #29435b;
}

.manual-attachment-field input[type="file"]::file-selector-button {
    min-height: 2.1rem;
    margin-right: 0.65rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid #b6c8d9;
    border-radius: 5px;
    background: #edf4fa;
    color: #254963;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.manual-attachment-field input[type="file"]::file-selector-button:hover {
    background: #dceaf5;
    border-color: #799ab8;
}

.manual-analysis-action {
    display: flex;
}

.manual-analysis-action .btn {
    width: 100%;
    min-height: 2.55rem;
}

@media (max-width: 899px) {
    .search-actions {
        padding: var(--space-4);
    }

    .manual-offer-form {
        grid-template-columns: 1fr;
    }

    .manual-source-link,
    .manual-order-text {
        grid-column: auto;
    }

    .manual-analysis-action .btn {
        min-height: 2.7rem;
    }
}

/* Mobile-only fixes: these rules follow the desktop search layout on purpose. */
@media (max-width: 899px) {
    .search-actions form {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .automatic-search-details {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-actions form select,
    .search-actions form .btn {
        width: 100%;
    }

    .brand-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.5rem;
    }

    .logo {
        min-width: 0;
        flex: 1 1 auto;
    }

    .logo a {
        min-width: 0;
        gap: 0.2rem;
    }

    .nav-toggle {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Approved Home shell: kept last so legacy shared rules cannot change the
   approved header, single sidebar, or the intentionally empty Home canvas. */
.header {
    padding: 1rem 0;
    background: #DCECF8;
}

.header .container {
    max-width: 1320px;
}

.header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
}

.logo.product-brand {
    justify-self: start;
    margin: 0;
    text-align: left;
    transform: translateY(-0.22rem);
}

.logo.product-brand a {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #0c4f96;
    text-decoration: none;
    white-space: normal;
}

.product-mark {
    display: inline-grid;
    box-sizing: border-box;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 0;
    position: relative;
}

.product-mark svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: #2E5F8D;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.product-mark::after {
    position: absolute;
    top: 4px;
    right: -10px;
    height: 32px;
    border-right: 2px solid rgba(46, 95, 141, 0.72);
    content: "";
}

.product-identity {
    display: grid;
    gap: 0.05rem;
}

.product-title {
    color: #214F78;
    font-size: clamp(1.55rem, 2.05vw, 2.15rem) !important;
    font-weight: 750;
    letter-spacing: -0.04em;
    line-height: 1.15;
    white-space: nowrap;
}

.product-subtitle {
    color: #15569c;
    font-size: clamp(1.15rem, 1.55vw, 1.55rem) !important;
    font-weight: 650;
    line-height: 1.2;
}

.environment-marker {
    position: relative;
    justify-self: center;
    margin: 0;
    padding: 0.55rem 1rem;
    border-color: #e0a300;
    background: #fff6d7;
    color: #7b4d08;
    font-size: 18px !important;
    box-shadow: none;
}

.header-actions {
    display: flex;
    justify-self: end;
    align-items: center;
    gap: 0.75rem;
}

.header-actions::before {
    width: 2px;
    height: 32px;
    margin-right: 8px;
    background: rgba(46, 95, 141, 0.72);
    content: "";
}

.account-icon {
    display: inline-grid;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: #2E5F8D;
}

.account-icon svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.nav-toggle {
    justify-self: auto;
}

.app-layout {
    grid-template-columns: minmax(250px, 285px) minmax(0, 1fr);
    gap: clamp(1.25rem, 3vw, 2.5rem);
}

.product-sidebar .product-nav {
    gap: 0;
    padding: 0.75rem;
}

.product-sidebar .nav-group {
    gap: 0.35rem;
}

.product-sidebar .product-nav a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 2.8rem;
    padding: 0.6rem 0.75rem;
    white-space: normal;
}

.product-nav--home {
    padding: 1rem;
    border: 1px solid #c9ddeb;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 4px 14px rgba(42, 78, 110, 0.07);
}

.product-sidebar--home {
    display: flex;
    align-self: stretch;
}

.product-sidebar--home .product-nav--home {
    flex: 0 0 auto;
    align-self: start;
}

.product-nav--home .nav-group {
    gap: 0.5rem;
}

.product-sidebar .product-nav--home a {
    min-height: 3.75rem;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #d9e8f3;
    border-radius: 11px;
    background: #f8fbfe;
    color: #1c4568;
    box-shadow: 0 1px 2px rgba(38, 73, 103, 0.04);
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.product-sidebar .product-nav--home a > span:last-child {
    font-size: 18px !important;
    font-weight: 650;
    line-height: 1.25;
}

.product-sidebar .product-nav--home a:hover {
    border-color: #a9c8e0;
    background: #edf6fc;
    color: #173b5c;
    box-shadow: 0 4px 10px rgba(38, 73, 103, 0.08);
    text-decoration: none;
    transform: translateY(-1px);
}

.product-sidebar .product-nav--home a.active {
    border-color: #173f65;
    background: #173f65;
    color: #fff;
    box-shadow: 0 6px 14px rgba(23, 63, 101, 0.22);
}

.nav-icon {
    display: inline-grid;
    flex: 0 0 1.45rem;
    width: 1.45rem;
    height: 1.45rem;
    place-items: center;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.home-empty-area {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: clamp(28rem, calc(100vh - 12rem), 46rem);
    border: 0;
    border-radius: 26px;
    background:
        radial-gradient(ellipse 88% 58% at 105% 106%, transparent 46%, rgba(117, 183, 222, 0.14) 46.4%, transparent 47.2%),
        radial-gradient(ellipse 105% 70% at 106% 111%, transparent 51%, rgba(117, 183, 222, 0.11) 51.4%, transparent 52.1%),
        radial-gradient(ellipse at 100% 5%, rgba(255, 255, 255, 0.72), transparent 42%),
        linear-gradient(135deg, #eaf6fe 0%, #cae7f8 54%, #c0e0f3 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.home-page .header {
    margin-bottom: 0;
}

.home-page .header .container,
.home-page .app-layout.container {
    max-width: none;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.app-layout--home {
    min-height: calc(100vh - 7rem);
    grid-template-columns: clamp(20rem, 24.4vw, 25.5rem) minmax(0, 1fr);
    gap: 0;
}

.app-layout--home .product-sidebar--home {
    border: 1px solid #9bc9ef;
    border-radius: 1.25rem;
    background: linear-gradient(180deg, #f4faff 0%, #e4f2fc 100%);
    box-shadow: 0 1px 6px rgba(41, 96, 151, 0.05);
}

.app-layout--home .product-nav--home {
    padding: 0.875rem 0.8rem 1.2rem;
    border: 0;
    border-radius: inherit;
    background: transparent;
    box-shadow: none;
    align-content: start;
}

.app-layout--home .product-nav--home .nav-group {
    gap: 0.7rem;
}

.app-layout--home .product-sidebar .product-nav--home a {
    min-height: 4.1rem;
    gap: 0.92rem;
    padding: 0.68rem 1.35rem;
    border-color: #b3d5f3;
    border-radius: 1rem;
    background: linear-gradient(100deg, #f7fbff 0%, #e8f4fd 100%);
    box-shadow: none;
}

.app-layout--home .product-sidebar .product-nav--home a > span:last-child {
    font-size: 18px !important;
    font-weight: 600;
}

.app-layout--home .product-sidebar .product-nav--home a.active {
    border-color: #69BCE8;
    background: linear-gradient(135deg, #D8F1FC 0%, #A8DDF5 55%, #69BCE8 100%);
    color: #0D5B9A;
    box-shadow: 0 3px 8px rgba(105, 188, 232, 0.15);
}

.app-layout--home .nav-icon {
    flex-basis: 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
}

.app-layout--home .nav-icon svg {
    stroke-width: 1.7;
}

.app-layout--home .main {
    padding-bottom: 0;
}

.app-layout--personal {
    display: block;
}

.app-layout--workspace {
    display: block;
}

.app-layout--workspace .page-header h2 {
    color: #0D5B9A;
}

.workspace-top-nav {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0 0 1.25rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #c9ddeb;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #f8fcff 0%, #edf6fc 100%);
}

.workspace-top-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    color: #0D5B9A;
    font-weight: 600;
    text-decoration: none;
}

.workspace-top-nav a:hover {
    border-color: #a9c8e0;
    background: #f2f8fd;
    text-decoration: none;
}

.workspace-top-nav a.active {
    border-color: #8fc4e9;
    background: #dceffa;
    color: #0D5B9A;
}

.workspace-top-nav .workspace-home-link {
    margin-right: 0.2rem;
}

.app-layout--workspace .current-work-empty-state p {
    margin: 0;
    color: #40566d;
    font-size: var(--font-base);
    line-height: 1.55;
}

.app-layout--personal .page-header h2 {
    color: #0D5B9A;
}

.app-layout--personal .directions-intro {
    border-color: #bdd7ea;
    background: linear-gradient(135deg, #f8fcff 0%, #edf6fc 100%);
}

.app-layout--personal .directions-intro p {
    color: #315F82;
}

.app-layout--personal .direction-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.45rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    font-weight: 700;
    white-space: nowrap;
}

.app-layout--personal .direction-status--suitable {
    border-color: #4d8fc1;
    color: #0D5B9A;
    background: #f2f8fd;
}

.app-layout--personal .direction-status--limited {
    border-color: #a8bfce;
    color: #527187;
    background: #f6f9fb;
}

.app-layout--personal .table-scroll.direction-matrix-wrap {
    box-sizing: border-box;
    width: 100%;
    padding: 0.65rem;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

.app-layout--personal .table-scroll.direction-matrix-wrap .direction-matrix {
    margin: 0;
}

@media (min-width: 1100px) {
    .app-layout--personal .table-scroll.direction-matrix-wrap {
        overflow-x: hidden;
    }

    .app-layout--personal .table-scroll.direction-matrix-wrap .direction-matrix {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .app-layout--personal .direction-matrix .direction-source-name {
        width: 170px;
        min-width: 0;
    }

    .app-layout--personal .direction-matrix th,
    .app-layout--personal .direction-matrix td {
        min-width: 0;
        padding-right: 0.45rem;
        padding-left: 0.45rem;
    }
}

.app-layout--personal > .main > .personal-home-link {
    display: inline-flex;
    align-items: center;
    margin: 0 0 1.25rem;
    color: #214F78;
    font-size: 22px !important;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.app-layout--personal > .main > .personal-home-link:hover {
    color: #06477d;
    text-decoration: underline;
}

@media (max-width: 899px) {
    .app-layout--personal > .main > .personal-home-link {
        font-size: 20px !important;
    }
}

.profile-onboarding {
    max-width: 58rem;
}

.profile-onboarding h3 {
    margin-top: 0;
}

.profile-direction-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.profile-direction-choice {
    min-height: 4.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid #b3d5f3;
    border-radius: 0.85rem;
    background: linear-gradient(100deg, #f7fbff 0%, #e8f4fd 100%);
    color: #0D5B9A;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-align: left;
}

.profile-direction-choice:hover,
.profile-direction-choice:focus-visible {
    border-color: #69BCE8;
    background: #dff2fd;
    outline: none;
}

.profile-direction-choice.is-selected {
    border-color: #3C98D5;
    background: linear-gradient(135deg, #D8F1FC 0%, #A8DDF5 55%, #69BCE8 100%);
    box-shadow: 0 2px 7px rgba(60, 152, 213, 0.18);
}

.app-layout--home .home-empty-area {
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 7rem);
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #3185C6 0%, #2269A8 52%, #194F88 100%);
    box-shadow: none;
}

.app-layout--home .home-empty-area::before,
.app-layout--home .home-empty-area::after {
    display: none;
}

.home-keywords {
    position: absolute;
    z-index: 1;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.home-glow-overlay {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.home-keyword {
    position: absolute;
    color: rgba(220, 236, 248, 0.34);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1;
    white-space: nowrap;
    filter: blur(0.2px);
    user-select: none;
}

.home-keyword--copywriting,
.home-keyword--smm,
.home-keyword--design,
.home-keyword--photomontage,
.home-keyword--video,
.home-keyword--development {
    font-size: clamp(2rem, 2.45vw, 2.625rem) !important;
}

.home-keyword--marketing,
.home-keyword--illustration,
.home-keyword--web-design,
.home-keyword--programming,
.home-keyword--advertising,
.home-keyword--color {
    color: rgba(225, 240, 250, 0.30);
    font-size: clamp(1.4375rem, 1.75vw, 1.9rem) !important;
}

.home-keyword--seo,
.home-keyword--voice,
.home-keyword--photo,
.home-keyword--motion,
.home-keyword--layout,
.home-keyword--ux,
.home-keyword--target,
.home-keyword--social,
.home-keyword--audio,
.home-keyword--editing,
.home-keyword--content,
.home-keyword--retouch,
.home-keyword--product-photo,
.home-keyword--animation,
.home-keyword--montage,
.home-keyword--texts {
    color: rgba(235, 245, 252, 0.26);
    font-size: clamp(1.125rem, 1.4vw, 1.45rem) !important;
}

.home-keyword--copywriting { top: 9%; left: 14%; }
.home-keyword--smm { top: 11%; left: 47%; }
.home-keyword--web-design { top: 8%; right: 18%; }
.home-keyword--layout { top: 19%; left: 8%; }
.home-keyword--editing { top: 21%; left: 27%; }
.home-keyword--content { top: 19%; left: 59%; }
.home-keyword--voice { top: 15%; right: 6%; }
.home-keyword--advertising { top: 23%; right: 12%; }
.home-keyword--seo { top: 29%; left: 6%; }
.home-keyword--marketing { top: 28%; left: 43%; }
.home-keyword--target { top: 32%; right: 7%; }
.home-keyword--design { top: 34%; left: 16%; }
.home-keyword--social { top: 39%; left: 56%; }
.home-keyword--ux { top: 42%; left: 38%; }
.home-keyword--development { top: 42%; right: 10%; }
.home-keyword--illustration { top: 47%; left: 7%; }
.home-keyword--programming { top: 51%; left: 32%; }
.home-keyword--color { top: 56%; left: 64%; }
.home-keyword--retouch { top: 59%; left: 6%; }
.home-keyword--photomontage { top: 61%; left: 20%; }
.home-keyword--texts { top: 62%; left: 52%; }
.home-keyword--motion { top: 62%; right: 5%; }
.home-keyword--montage { top: 66%; left: 46%; }
.home-keyword--product-photo { top: 73%; left: 28%; }
.home-keyword--animation { top: 76%; left: 55%; }
.home-keyword--photo { top: 78%; left: 6%; }
.home-keyword--video { top: 78%; right: 8%; }
.home-keyword--audio { top: 83%; left: 40%; }

.home-empty-area::before,
.home-empty-area::after {
    position: absolute;
    z-index: 0;
    content: "";
    pointer-events: none;
}

.home-empty-area::before {
    width: 110%;
    height: 90%;
    top: -71%;
    left: -36%;
    border: 1px solid rgba(230, 247, 255, 0.68);
    border-radius: 50%;
    box-shadow: none;
    transform: rotate(-7deg);
}

.home-empty-area::after {
    width: 126%;
    height: 61%;
    right: -37%;
    bottom: -41%;
    border: 1px solid rgba(140, 216, 250, 0.28);
    border-radius: 50%;
    box-shadow: 0 -5.5rem 0 -5.45rem rgba(127, 211, 250, 0.16);
    transform: rotate(-8deg);
}

@media (max-width: 899px) {
    .header-inner {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .environment-marker {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: start;
    }

    .environment-marker::before {
        display: none;
    }

    .logo.product-brand {
        min-width: 0;
    }

    .product-title {
        font-size: 1.35rem !important;
    }

    .product-nav--home {
        border-radius: 14px;
    }

    .product-sidebar .product-nav--home a {
        min-height: 3.25rem;
    }

    .home-empty-area {
        min-height: 24rem;
        border-radius: 16px;
    }

    .product-mark {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        border-width: 0;
    }

    .product-mark svg {
        width: 34px;
        height: 34px;
    }

    .account-icon {
        display: none;
    }

    .header-actions::before {
        display: none;
    }

    .app-layout--home {
        min-height: 0;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .app-layout--home .product-sidebar--home {
        border-radius: 0.9rem;
    }

    .app-layout--home .product-nav--home {
        padding: 0.75rem;
    }

    .app-layout--home .product-sidebar .product-nav--home a {
        min-height: 3.4rem;
        padding-inline: 1rem;
    }

    .app-layout--home .product-sidebar .product-nav--home a > span:last-child {
        font-size: 17px !important;
    }

    .app-layout--home .nav-icon {
        flex-basis: 1.75rem;
        width: 1.75rem;
        height: 1.75rem;
    }

    .app-layout--home .home-empty-area {
        min-height: 24rem;
        border-radius: 0.9rem;
    }

    .home-keyword--copywriting,
    .home-keyword--smm,
    .home-keyword--design,
    .home-keyword--photomontage,
    .home-keyword--video {
        font-size: clamp(1.45rem, 8vw, 2.1rem) !important;
    }

    .home-keyword--editing,
    .home-keyword--marketing,
    .home-keyword--illustration,
    .home-keyword--content,
    .home-keyword--retouch {
        font-size: clamp(1rem, 5vw, 1.35rem) !important;
    }
}
