:root {
    --accent: #c74445;
    --accent-hover: #ad3436;
    --accent-strong: #962d2f;
    --accent-soft: #fbeeee;
    --accent-softer: #fff7f7;
    --ink: #171716;
    --text: #3f3d3a;
    --muted: #77726c;
    --line: #e6e2dc;
    --line-strong: #d7d1c9;
    --surface: #ffffff;
    --surface-muted: #faf9f7;
    --background: #f6f5f2;
    --success: #25794d;
    --success-soft: #eaf6ef;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --warning: #996515;
    --shadow-xs: 0 1px 2px rgba(35, 30, 26, 0.04);
    --shadow-sm: 0 8px 26px rgba(35, 30, 26, 0.06);
    --shadow-md: 0 20px 52px rgba(35, 30, 26, 0.1);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    color: var(--text);
    background: var(--background);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--background);
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--accent-strong);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--accent);
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid rgba(199, 68, 69, 0.24);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

.icon {
    width: 1.1em;
    height: 1.1em;
    display: inline-block;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.container {
    width: min(1220px, calc(100% - 48px));
    margin: 0 auto;
}

main.container {
    padding: 30px 0 72px;
}

#main-content:focus {
    outline: none;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid rgba(215, 209, 201, 0.8);
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 1px 0 rgba(35, 30, 26, 0.02);
    backdrop-filter: blur(16px);
}

.navigation {
    min-height: 72px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 34px;
}

.brand {
    display: inline-flex;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover {
    color: var(--ink);
}

.brand-logo {
    display: block;
    width: 196px;
    height: auto;
}

.primary-navigation {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 11px;
    padding: 9px 13px;
    color: #5c5853;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: var(--surface-muted);
    color: var(--ink);
}

.nav-link.is-active .icon {
    color: var(--accent);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu form {
    margin: 0;
}

.user-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid #e8c9bf;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
}

.user-summary {
    min-width: 112px;
    max-width: 210px;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-summary strong,
.user-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-summary strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 720;
}

.user-summary small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.icon-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.icon-button:hover {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--accent-strong);
}

.icon-button .icon {
    width: 19px;
    height: 19px;
}

.context-navigation {
    margin-bottom: 22px;
}

.back-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 9px;
    padding: 6px 9px 6px 5px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.back-link:hover {
    background: var(--surface);
    color: var(--accent-strong);
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin: 8px 0 30px;
}

.page-heading h1 {
    max-width: 820px;
    margin: 4px 0 8px;
    color: var(--ink);
    font-size: clamp(34px, 4.2vw, 52px);
    font-weight: 780;
    line-height: 1.03;
    letter-spacing: -0.05em;
}

.page-description {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
}

.page-meta-line {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h2 {
    margin: 0 0 18px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

h3 {
    margin-top: 28px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 730;
}

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

.button,
button:not(.tab-button):not(.icon-button):not(.sort-chip):not(.calendar-event):not(.calendar-day-number):not(.calendar-week-day-heading):not(.mini-calendar-day-button):not(.mini-calendar-task):not(.archive-project-button):not([data-date-preset]) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 10px 17px;
    background: var(--accent);
    box-shadow: 0 5px 14px rgba(199, 68, 69, 0.12);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 720;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button:hover,
button:not(.tab-button):not(.icon-button):not(.sort-chip):not(.calendar-event):not(.calendar-day-number):not(.calendar-week-day-heading):not(.mini-calendar-day-button):not(.mini-calendar-task):not(.archive-project-button):not([data-date-preset]):hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    box-shadow: 0 7px 18px rgba(173, 52, 54, 0.18);
    color: #fff;
    transform: translateY(-1px);
}

.button:active,
button:not(.tab-button):not(.icon-button):not(.sort-chip):not(.calendar-event):not(.calendar-day-number):not(.calendar-week-day-heading):not(.mini-calendar-day-button):not(.mini-calendar-task):not(.archive-project-button):not([data-date-preset]):active {
    transform: translateY(0);
}

.button .icon,
button .icon {
    width: 17px;
    height: 17px;
}

.button-quiet,
.button-outline {
    border-color: var(--line-strong);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    color: var(--ink);
}

.button-quiet:hover,
.button-outline:hover {
    border-color: #d9a7a8;
    background: var(--accent-softer);
    box-shadow: var(--shadow-xs);
    color: var(--accent-strong);
}

.button-small {
    min-height: 38px !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
}

.button-wide {
    width: 100%;
}

.heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Список проектов */
.project-list-heading {
    margin-bottom: 20px;
}

.workspace-heading {
    margin-bottom: 20px;
}

.workspace-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.workspace-nav-link {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    padding: 10px 16px 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 720;
    text-decoration: none;
}

.workspace-nav-link:hover,
.workspace-nav-link.is-active {
    border-bottom-color: var(--accent);
    color: var(--accent-strong);
}

.workspace-nav-link .icon {
    width: 18px;
    height: 18px;
}

.project-list-section {
    animation: content-in 260ms ease both;
}

[data-project-list-content] {
    transition: opacity 140ms ease;
}

[data-project-list-content].is-loading {
    opacity: 0.58;
    pointer-events: none;
}

.project-list-toolbar {
    position: sticky;
    z-index: 12;
    top: 84px;
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding: 14px 18px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
}

.project-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-filter-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.service-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.service-filter-chip {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 9px 14px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 720;
    text-decoration: none;
    white-space: nowrap;
}

.service-filter-chip:hover,
.service-filter-chip:focus-visible {
    border-color: var(--accent);
    background: var(--accent-softer);
    color: var(--accent-strong);
}

.service-filter-chip.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.service-filter-chip.is-active:hover {
    background: var(--accent-hover);
    color: #fff;
}

.project-sort-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.project-advanced-filters {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.project-filter-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 9px;
}

.compact-field {
    min-width: 180px;
    margin: 0;
}

.compact-field label {
    margin-bottom: 4px;
    font-size: 11px;
}

.compact-field select,
.compact-field input {
    min-height: 40px;
    padding: 7px 10px;
    font-size: 13px;
}

.date-range-picker {
    position: relative;
}

.date-range-picker summary {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 7px 11px;
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.date-range-picker summary::-webkit-details-marker {
    display: none;
}

.date-range-picker summary .icon {
    width: 17px;
    height: 17px;
    color: var(--accent);
}

.date-range-picker[open] summary {
    border-color: var(--accent);
    background: var(--accent-softer);
}

.date-range-popover {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    width: min(460px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.date-range-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.date-range-quick-actions button {
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 5px 9px;
    background: var(--surface-muted);
    color: var(--ink);
    box-shadow: none;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.date-range-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.field-errors {
    margin: 10px 0;
    color: var(--danger);
    font-size: 13px;
}

.timeline-filter-form {
    margin: 0;
}

.timeline-filter summary.sort-chip {
    min-height: 36px;
    border-color: transparent;
    border-radius: 9px;
    padding: 7px 10px;
    background: transparent;
    font-size: 12px;
}

.timeline-filter[open] summary.sort-chip,
.timeline-filter summary.sort-chip.is-active {
    border-color: #e9bfc0;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.timeline-filter-hint {
    margin: 10px 0;
    font-size: 12px;
}

.project-count,
.sort-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.project-count .icon {
    color: var(--accent);
}

.project-count strong {
    color: var(--ink);
}

.sort-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sort-label {
    margin-right: 4px;
}

.sort-chip {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 7px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 680;
    text-decoration: none;
    white-space: nowrap;
}

.sort-chip:hover {
    background: var(--surface);
    color: var(--ink);
}

.sort-chip.is-active {
    border-color: #e9bfc0;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.sort-chip-placeholder,
.sort-chip-placeholder:hover {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--muted);
    cursor: default;
}

.project-card-list {
    display: grid;
    gap: 14px;
}

.project-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.project-card:hover {
    border-color: #d9cfc7;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.project-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(199, 68, 69, 0.12);
}

.project-card-main {
    padding: 20px 22px 18px;
}

.project-card-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 28px;
}

.project-title {
    position: static;
    color: var(--ink);
    font-size: 21px;
    font-weight: 760;
    line-height: 1.2;
    letter-spacing: -0.025em;
    text-decoration: none;
}

.project-title:hover {
    color: var(--accent-strong);
}

.stretched-link::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    content: "";
}

.project-service-summary {
    max-width: 760px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.project-service-label {
    width: 100%;
    color: #948e87;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.project-service-summary strong {
    color: var(--text);
    font-weight: 680;
}

.project-service-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-service-items span,
.service-group li {
    border: 1px solid #f1d9da;
    border-radius: 999px;
    padding: 5px 9px;
    background: var(--accent-softer);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.project-service-items-large {
    gap: 8px;
}

.project-service-items-large span {
    padding: 7px 11px;
    font-size: 13px;
}

.project-card-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-card-status strong {
    min-width: 38px;
    color: var(--ink);
    font-size: 15px;
    text-align: right;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e3dfdb;
    border-radius: 999px;
    padding: 6px 10px;
    background: #f3f2f0;
    color: #595651;
    font-size: 12px;
    font-weight: 720;
    white-space: nowrap;
}

.status-badge[data-status="CONTRACT"],
.status-badge[data-status="ADVANCE"],
.status-badge[data-status="FIELD_WORK"],
.status-badge[data-status="OFFICE_WORK"],
.status-badge[data-status="INTERNAL_REVIEW"],
.status-badge[data-status="CLIENT_REVIEW"],
.status-badge[data-status="PAYMENT_UPD"],
.status-badge[data-status="REVIEW"],
.status-badge[data-status="WAITING_CUSTOMER"] {
    border-color: #f1d1d2;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.status-badge[data-status="COMPLETED"] {
    border-color: #cce5d6;
    background: var(--success-soft);
    color: var(--success);
}

.status-badge[data-status="PAUSED"] {
    border-color: #dedede;
    background: #eeeeed;
    color: #615e5a;
}

.status-large {
    padding: 8px 12px;
    font-size: 13px;
}

.progress-track {
    overflow: hidden;
    border-radius: 999px;
    background: #eae7e3;
}

.progress-card {
    height: 6px;
    margin-top: 16px;
}

.progress-large {
    height: 9px;
}

.progress-compact {
    width: 150px;
    height: 6px;
    margin-top: 9px;
}

.progress-fill {
    width: var(--progress);
    height: 100%;
    display: block;
    border-radius: inherit;
    background: var(--accent);
    transition: width 280ms ease;
}

.progress-track[data-status="COMPLETED"] .progress-fill {
    background: var(--success);
}

.progress-track[data-status="PAUSED"] .progress-fill {
    width: 100%;
    background: #aaa7a3;
}

.project-card-footer {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 13px 22px;
    border-top: 1px solid #efedea;
    background: var(--surface-muted);
}

.project-meta-item {
    min-width: 150px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.project-meta-item > .icon {
    width: 18px;
    height: 18px;
    color: #8a857f;
}

.project-meta-item span {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.project-meta-item small {
    margin-bottom: 3px;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.project-meta-item strong {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-meta-editor {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    overflow-wrap: anywhere;
}

.project-row-actions {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Карточка проекта */
.project-tabs {
    margin-top: 4px;
}

.tab-list {
    position: sticky;
    z-index: 12;
    top: 84px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    margin-bottom: 20px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(250, 249, 247, 0.94);
    box-shadow: var(--shadow-xs);
    backdrop-filter: blur(12px);
    scrollbar-width: thin;
}

.tab-button {
    min-height: 42px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 14px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.tab-button .icon {
    width: 17px;
    height: 17px;
}

.tab-button:hover {
    background: var(--surface);
    color: var(--ink);
}

.tab-button.is-active {
    border-color: var(--line-strong);
    background: var(--surface);
    box-shadow: 0 3px 10px rgba(35, 30, 26, 0.06);
    color: var(--ink);
}

.tab-button.is-active .icon {
    color: var(--accent);
}

.tab-button-customer.is-active {
    border-color: #e7bfc0;
    background: var(--accent-softer);
    color: var(--accent-strong);
}

.tab-button-internal.is-active {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.tab-button-internal.is-active .icon {
    color: #fff;
}

.tab-panel {
    animation: content-in 220ms ease both;
}

.tab-panel:focus {
    outline: none;
}

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

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

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

.project-history-list li {
    display: grid;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.project-history-list li:first-child {
    padding-top: 0;
}

.project-history-list li:last-child {
    border-bottom: 0;
}

.project-history-list time,
.project-history-list li > span {
    color: var(--muted);
    font-size: 13px;
}

.project-history-more {
    margin-top: 14px;
}

.project-history-more summary {
    width: fit-content;
    list-style: none;
}

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

.project-history-more .project-history-list {
    margin-top: 14px;
}

.card {
    margin-bottom: 16px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.card-title-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.card-title-line > .icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.card-title-line h2 {
    margin: 0;
}

dl {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 0 18px;
    margin: 0;
}

dt,
dd {
    padding: 10px 0;
    border-bottom: 1px solid #f0eeeb;
}

dt:nth-last-of-type(1),
dd:nth-last-of-type(1) {
    border-bottom: 0;
}

dt {
    color: var(--muted);
    font-size: 13px;
}

dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-weight: 620;
}

.project-status-card {
    overflow: hidden;
    background: linear-gradient(135deg, #fff 0%, #fff 65%, #fff7f7 100%);
}

.archive-project-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 0;
}

.archive-project-button:disabled {
    border-color: var(--line);
    background: var(--surface-muted);
    box-shadow: none;
    color: var(--muted);
    cursor: not-allowed;
    opacity: 1;
}

.archive-project-button.is-ready {
    border-color: var(--success);
    background: var(--success);
    box-shadow: 0 8px 18px rgba(39, 128, 80, 0.2);
    color: #fff;
}

.archive-project-button.is-ready:hover {
    border-color: #206d45;
    background: #206d45;
    box-shadow: 0 10px 20px rgba(39, 128, 80, 0.24);
    color: #fff;
    transform: translateY(-1px);
}

.archive-state {
    margin: 14px 0 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

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

.project-status-calendar-grid.is-client {
    grid-template-columns: 1fr;
}

.project-status-calendar-grid > .card {
    min-width: 0;
}

.project-mini-calendar {
    overflow: hidden;
}

.mini-calendar-header,
.mini-calendar-navigation,
.project-task-heading,
.project-task-title-line,
.project-task-admin-actions {
    display: flex;
    align-items: center;
}

.mini-calendar-header,
.project-task-heading {
    justify-content: space-between;
    gap: 14px;
}

.mini-calendar-header .card-title-line {
    margin-bottom: 0;
}

.mini-calendar-navigation {
    gap: 4px;
}

.mini-calendar-title {
    display: block;
    margin: 14px 0 10px;
    text-transform: capitalize;
}

.mini-calendar-status,
.mini-calendar-hint {
    font-size: 12px;
}

.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--line);
}

.mini-calendar-weekday {
    padding: 5px 2px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-align: center;
}

.mini-calendar-day {
    min-width: 0;
    min-height: 58px;
    padding: 3px;
    background: var(--surface);
}

.mini-calendar-day.is-outside {
    background: var(--surface-muted);
    color: #aaa39c;
}

.mini-calendar-day-button,
.mini-calendar-task {
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.mini-calendar-task.is-event {
    border-left: 2px solid #416788;
    background: #edf4f8;
    color: #31526e;
}

.mini-calendar-task.is-task {
    border-left: 2px solid var(--success);
    background: var(--success-soft);
    color: #195c39;
}

.mini-calendar-day-button {
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 750;
}

.mini-calendar-day.is-today .mini-calendar-day-button {
    background: var(--accent);
    color: #fff;
}

.mini-calendar-task {
    width: 100%;
    display: block;
    overflow: hidden;
    margin-top: 2px;
    border-radius: 4px;
    padding: 2px 3px;
    background: var(--accent-softer);
    color: var(--accent-strong);
    font-size: 8px;
    font-weight: 700;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-calendar-task.is-completed {
    background: var(--success-soft);
    color: var(--success);
    text-decoration: line-through;
}

.mini-calendar-day small {
    display: block;
    margin-top: 2px;
    font-size: 8px;
    text-align: center;
}

.mini-calendar-hint {
    margin: 10px 0 0;
}

.project-task-list {
    display: grid;
    gap: 12px;
}

.project-task-list > .card {
    margin-bottom: 0;
}

.project-task-card.is-completed {
    border-color: #b9d9c6;
    background: linear-gradient(135deg, #fff 0%, var(--success-soft) 140%);
}

.project-task-title-line {
    flex-wrap: wrap;
    gap: 8px;
}

.project-task-title-line h2 {
    margin: 0;
}

.task-kind,
.task-state {
    border-radius: 999px;
    padding: 4px 8px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 10px;
    font-weight: 760;
}

.task-state.is-completed {
    background: var(--success-soft);
    color: var(--success);
}

.task-dates {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.task-dates span {
    display: inline-flex;
    margin-left: 7px;
    border-radius: 999px;
    padding: 2px 7px;
    background: var(--surface-muted);
    font-size: 10px;
    font-weight: 720;
}

.task-dates .task-calendar-state {
    background: var(--success-soft);
    color: var(--success);
}

.task-description {
    margin-top: 14px;
}

.task-assignee-list {
    display: grid;
    gap: 7px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.task-assignee-list li,
.task-assignee-list form,
.task-assignee-list label {
    display: flex;
    align-items: center;
}

.task-assignee-list li,
.task-assignee-list form {
    justify-content: space-between;
    gap: 12px;
}

.task-assignee-list li {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px 10px;
    background: var(--surface-muted);
}

.task-assignee-list form {
    width: 100%;
}

.task-assignee-list label {
    gap: 9px;
    font-size: 13px;
    font-weight: 650;
}

.task-assignee-list li.is-completed label span {
    color: var(--muted);
    text-decoration: line-through;
}

.task-assignee-list li.is-completed {
    border-color: #b9d9c6;
    background: var(--success-soft);
}

.task-assignee-list form.is-enhanced > button {
    display: none;
}

.project-task-admin-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.project-task-editor {
    position: relative;
}

.project-task-editor summary {
    list-style: none;
    cursor: pointer;
}

.project-task-editor summary::-webkit-details-marker {
    display: none;
}

.project-task-editor[open] {
    width: 100%;
}

.project-task-editor[open] summary {
    margin-bottom: 14px;
}

.project-task-editor form {
    border-radius: 12px;
    padding: 16px;
    background: var(--surface-muted);
}

.task-participants-field .employee-choice-grid {
    max-height: 220px;
    overflow-y: auto;
}

.task-schedule-options {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.task-schedule-fields {
    display: grid;
    gap: 12px;
    border-left: 3px solid #efc5c6;
    padding: 12px 0 2px 14px;
}

.status-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
}

.status-card-header .card-title-line {
    margin-bottom: 10px;
}

.status-progress-value {
    color: var(--ink);
    font-size: 24px;
    font-weight: 760;
    letter-spacing: -0.03em;
}

.status-update-form {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.inline-form .field {
    min-width: 260px;
}

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

.service-group {
    padding: 18px;
    border: 1px solid #ece9e5;
    border-radius: 13px;
    background: var(--surface-muted);
}

.service-group h3 {
    margin: 0 0 12px;
    font-size: 14px;
}

.service-group ul {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.empty-inline-state,
.future-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 30px 22px;
    border: 1px dashed var(--line-strong);
    border-radius: 13px;
    background: var(--surface-muted);
    color: var(--muted);
    text-align: center;
}

.empty-inline-state strong,
.future-upload strong {
    color: var(--ink);
}

.future-upload-icon,
.empty-state-icon,
.success-state-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
}

.future-upload-icon {
    margin-bottom: 7px;
}

.future-upload-icon .icon,
.empty-state-icon .icon,
.success-state-icon .icon {
    width: 23px;
    height: 23px;
}

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

.section-heading h2,
.section-heading p,
.section-heading .card-title-line {
    margin-bottom: 0;
}

.coming-soon {
    flex: 0 0 auto;
    border: 1px solid #e1ddd8;
    border-radius: 999px;
    padding: 6px 10px;
    background: #f2f1ef;
    color: #69655f;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Чаты */
.chat-channel {
    overflow: hidden;
    padding: 0;
}

.chat-channel-customer {
    border-top: 3px solid var(--accent);
}

.chat-channel-internal {
    border-top: 3px solid var(--ink);
}

.chat-channel-global {
    border-top: 3px solid var(--accent);
}

.global-chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    align-items: start;
    gap: 18px;
}

.global-chat-layout .chat-message-list {
    min-height: 420px;
}

.global-chat-members ul {
    display: grid;
    gap: 4px;
    max-height: 580px;
    overflow: auto;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.global-chat-members li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 2px;
    font-size: 13px;
    font-weight: 620;
    overflow-wrap: anywhere;
}

.member-presence {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--success);
}

.interactive-calendar {
    padding: 0;
    overflow: hidden;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
}

.calendar-navigation,
.calendar-view-switch {
    display: flex;
    align-items: center;
    gap: 7px;
}

.calendar-view-switch .sort-chip {
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.calendar-navigation h2 {
    margin: 0 0 0 8px;
    font-size: 24px;
    text-transform: capitalize;
}

.calendar-loading {
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--line);
}

.calendar-weekday {
    padding: 10px 12px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.calendar-day {
    min-height: 112px;
    padding: 12px;
    background: var(--surface);
}

.interactive-calendar-day {
    min-width: 0;
    padding: 7px;
}

.calendar-day-number,
.calendar-week-day-heading {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    cursor: pointer;
}

.calendar-day-number {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    padding: 0;
    font-size: 13px;
    font-weight: 720;
}

.calendar-day-number:hover,
.calendar-week-day-heading:hover {
    background: var(--accent-softer);
    color: var(--accent-strong);
}

.calendar-day.is-today .calendar-day-number {
    background: var(--accent);
    color: #fff;
}

.calendar-day-events,
.calendar-week-events {
    display: grid;
    gap: 4px;
    margin-top: 5px;
}

.calendar-event {
    width: 100%;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 5px 6px;
    background: var(--accent-softer);
    box-shadow: none;
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 720;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.calendar-event:hover {
    background: #f5dddc;
}

.calendar-event-deadline {
    border-left-color: #9b2c2c;
}

.calendar-event-meeting {
    border-left-color: #416788;
    background: #edf4f8;
    color: #31526e;
}

.calendar-event-internal {
    border-left-color: #71685f;
    background: #f1efed;
    color: #514a44;
}

.calendar-event-task {
    border-left-color: var(--success);
    background: var(--success-soft);
    color: #195c39;
}

.calendar-event-task.is-completed {
    opacity: 0.68;
    text-decoration: line-through;
}

.calendar-week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    background: var(--line);
    gap: 1px;
}

.calendar-week-day {
    min-height: 440px;
    padding: 9px;
    background: var(--surface);
}

.calendar-week-day.is-today {
    background: var(--accent-softer);
}

.calendar-week-day-heading {
    width: 100%;
    display: grid;
    justify-items: center;
    gap: 3px;
    border-radius: 9px;
    padding: 7px;
}

.calendar-week-day-heading span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.calendar-week-day-heading strong {
    font-size: 20px;
}

.calendar-week-empty {
    padding: 12px 4px;
    font-size: 12px;
    text-align: center;
}

.crm-dialog {
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-md);
}

.crm-dialog::backdrop {
    background: rgba(23, 21, 20, 0.46);
    backdrop-filter: blur(3px);
}

.dialog-heading,
.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.dialog-heading {
    margin-bottom: 20px;
}

.dialog-heading h2 {
    margin: 3px 0 0;
}

.dialog-actions {
    justify-content: flex-end;
    margin-top: 20px;
}

.form-errors {
    margin-bottom: 14px;
    border: 1px solid #e9b4b4;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff2f2;
    color: var(--danger);
    font-size: 13px;
}

.calendar-participants-field .employee-choice-grid {
    max-height: 190px;
    overflow-y: auto;
}

.calendar-event-details {
    grid-template-columns: 130px minmax(0, 1fr);
}

.calendar-event-description {
    margin-top: 18px;
    border-radius: 10px;
    padding: 14px;
    background: var(--surface-muted);
    color: var(--muted);
}

.calendar-day.is-outside {
    background: var(--surface-muted);
    color: #aaa39c;
}

.calendar-day time {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 720;
}

.calendar-day.is-today {
    background: var(--accent-softer);
}

.calendar-day.is-today time {
    background: var(--accent);
    color: #fff;
}

.calendar-note {
    margin: 0;
    padding: 16px 24px;
    color: var(--muted);
    font-size: 13px;
}

.chat-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.chat-title-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-title-icon {
    width: 40px;
    height: 40px;
    display: grid;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
}

.chat-channel-internal .chat-title-icon {
    background: #efefee;
    color: var(--ink);
}

.chat-title-icon .icon {
    width: 20px;
    height: 20px;
}

.chat-channel-header h2 {
    margin: 1px 0 0;
}

.chat-channel-label {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.chat-channel-customer .chat-channel-label {
    color: var(--accent-strong);
}

.chat-visibility-notice {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    border: 1px solid #e1ddd8;
    border-radius: 999px;
    padding: 7px 11px;
    background: #f3f2f0;
    color: #4f4c48;
    font-size: 12px;
    font-weight: 700;
}

.chat-channel-customer .chat-visibility-notice {
    border-color: #efd0d1;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.chat-message-list {
    max-height: 540px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin: 0;
    padding: 22px;
    background: #f8f7f5;
    list-style: none;
    scrollbar-color: #ccc6bf transparent;
    scrollbar-width: thin;
}

.chat-message {
    width: min(78%, 720px);
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 5px 14px 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.chat-message.is-own {
    align-self: flex-end;
    border-radius: 14px 5px 14px 14px;
}

.chat-channel-customer .chat-message.is-own {
    border-color: #ecc5c6;
    background: var(--accent-softer);
}

.chat-channel-internal .chat-message.is-own {
    border-color: #d9d6d2;
    background: #f0efed;
}

.chat-channel-global .chat-message.is-own {
    border-color: #edc5c5;
    background: var(--accent-softer);
}

.chat-members-panel {
    display: grid;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.chat-members-panel strong {
    color: var(--ink);
    font-size: 14px;
}

.chat-members-panel p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.chat-members-panel form {
    display: grid;
    justify-items: start;
    gap: 12px;
}

.chat-members-panel div.employee-choice-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.chat-members-panel div.employee-choice-grid label {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.chat-members-panel div.employee-choice-grid label:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-softer);
    color: var(--accent-strong);
}

.chat-members-panel div.employee-choice-grid input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--accent);
}

.chat-access-note {
    margin: 0;
    padding: 24px;
    color: var(--muted);
}

.chat-message-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
    font-size: 11px;
}

.chat-message-meta strong {
    color: var(--ink);
}

.chat-message-meta time {
    flex: 0 0 auto;
    color: var(--muted);
}

.chat-message-body {
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.chat-empty-message {
    padding: 38px 20px;
    color: var(--muted);
    text-align: center;
}

.chat-compose {
    padding: 20px 22px 22px;
    border-top: 1px solid var(--line);
}

.chat-compose textarea {
    min-height: 112px;
    resize: vertical;
}

.chat-compose-hint {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.chat-compose-error:not([hidden]) {
    margin: 0 0 12px;
    color: #8f1c13;
}

.chat-compose > button {
    margin-top: 12px;
}

.chat-channel-internal .chat-compose > button {
    border-color: var(--ink);
    background: var(--ink);
    box-shadow: none;
}

.chat-channel-internal .chat-compose > button:hover {
    border-color: #000;
    background: #000;
}

.chat-confirmation {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 8px 10px;
    margin-top: 11px;
    padding: 12px 13px;
    border: 1px solid #ebbbbd;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.chat-confirmation input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.chat-confirmation label {
    font-size: 13px;
    font-weight: 700;
}

.chat-confirmation .errorlist {
    grid-column: 1 / -1;
    margin: 0;
}

/* Доступ клиентов и файлы */
.client-access-card {
    border-color: #e4c9ca;
    background: #fffdfd;
}

.client-access-badge {
    border-color: #efd0d1;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.magic-link-result {
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #b9d9c6;
    border-radius: 13px;
    background: var(--success-soft);
}

.magic-link-result strong {
    color: #195c39;
}

.magic-link-result p {
    margin: 6px 0 14px;
}

.copy-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.copy-link-row input {
    background: rgba(255, 255, 255, 0.76);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
}

.client-invitation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.client-access-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.client-access-columns h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 10px;
}

.client-access-columns h3 .icon {
    color: var(--accent);
}

.plain-list,
.link-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-list > li,
.link-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 58px;
    padding: 10px 0;
    border-bottom: 1px solid #ece9e5;
}

.plain-list > li:last-child,
.link-list li:last-child {
    border-bottom: 0;
}

.plain-list strong,
.plain-list small,
.link-list small {
    display: block;
}

.plain-list form,
.link-list form {
    flex: 0 0 auto;
}

.cloud-link-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    text-decoration: none;
}

/* Формы */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    color: var(--ink);
    font-size: 12px;
    font-weight: 720;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    padding: 9px 12px;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 0;
    border-radius: 5px;
    padding: 0;
    accent-color: var(--accent);
    box-shadow: none;
}

div.employee-choice-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

div.employee-choice-grid > div {
    min-width: 0;
}

div.employee-choice-grid label {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 7px 10px;
    background: var(--surface-muted);
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

div.employee-choice-grid label:has(input:checked) {
    border-color: #e6afb1;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.compact-checkbox-row {
    width: fit-content;
    max-width: 100%;
    min-height: 36px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 7px 10px;
    background: var(--surface-muted);
    color: var(--ink);
    font-size: 13px;
    font-weight: 680;
    cursor: pointer;
}

.compact-checkbox-row:has(input:checked) {
    border-color: #e6afb1;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

input:hover,
select:hover,
textarea:hover {
    border-color: #bbb4ac;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(199, 68, 69, 0.13);
}

input[readonly] {
    color: #5a5651;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 16px;
}

.secondary,
button.secondary {
    border-color: #e6b5b7;
    background: var(--surface);
    box-shadow: none;
    color: var(--danger);
}

.secondary:hover,
button.secondary:hover {
    border-color: var(--danger);
    background: var(--danger-soft);
    box-shadow: none;
    color: var(--danger);
}

.form-error,
.errorlist {
    color: var(--danger);
}

.errorlist {
    margin: 4px 0;
    padding-left: 18px;
    font-size: 13px;
}

/* Вход и состояния */
.auth-page {
    background:
        radial-gradient(circle at 12% 10%, rgba(199, 68, 69, 0.08), transparent 28%),
        radial-gradient(circle at 88% 90%, rgba(23, 23, 22, 0.05), transparent 28%),
        var(--background);
}

.auth-page main.container {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding-top: 40px;
    padding-bottom: 40px;
}

.login-card {
    width: min(458px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-md);
    animation: login-in 320ms ease both;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.login-brand-logo {
    display: block;
    width: min(250px, 100%);
    height: auto;
}

.login-brand h1 {
    margin: 0;
    color: var(--ink);
    font-size: 28px;
    font-weight: 770;
    letter-spacing: -0.035em;
}

.login-intro {
    margin: 0 0 24px;
    color: var(--muted);
}

.login-card .field {
    margin-bottom: 15px;
}

.login-alternative {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.login-alternative-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 680;
    text-decoration: none;
}

.email-sent-state {
    text-align: center;
}

.email-sent-state .success-state-icon {
    margin: 0 auto 14px;
    background: var(--success-soft);
    color: var(--success);
}

.email-sent-state h2,
.magic-login-card h2 {
    margin-top: 18px;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.message {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #b9d9c6;
    border-radius: 12px;
    background: var(--success-soft);
    color: #195c39;
    font-size: 14px;
    font-weight: 620;
    animation: message-in 220ms ease both;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 58px 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    text-align: center;
}

.empty-state-icon {
    margin-bottom: 16px;
}

.empty-state h1,
.empty-state h2 {
    margin: 4px 0 8px;
    color: var(--ink);
}

.empty-state h1 {
    font-size: 32px;
    letter-spacing: -0.035em;
}

.empty-state p:not(.eyebrow) {
    max-width: 520px;
    margin: 0;
    color: var(--muted);
}

.error-state {
    margin-top: 7vh;
}

.error-state .button {
    margin-top: 22px;
}

.preserve-lines {
    overflow-wrap: anywhere;
}

.nowrap {
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

@keyframes content-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes login-in {
    from { opacity: 0; transform: translateY(10px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .navigation {
        gap: 18px;
    }

    .user-summary {
        display: none;
    }

    .global-chat-layout {
        grid-template-columns: 1fr;
    }

    .global-chat-members ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-card-footer {
        flex-wrap: wrap;
        gap: 15px 24px;
    }

    .project-row-actions {
        width: auto;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 28px, 1220px);
    }

    main.container {
        padding-top: 22px;
        padding-bottom: 48px;
    }

    .navigation {
        min-height: 64px;
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }

    .primary-navigation .nav-link span {
        display: none;
    }

    .brand-logo {
        width: 150px;
    }

    .primary-navigation {
        justify-content: flex-end;
    }

    .nav-link {
        width: 40px;
        min-height: 40px;
        justify-content: center;
        padding: 0;
    }

    .user-avatar {
        display: none;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
        margin-bottom: 24px;
    }

    .page-heading h1 {
        font-size: clamp(32px, 11vw, 44px);
    }

    .page-heading .button {
        align-self: flex-start;
    }

    .project-list-toolbar {
        top: 72px;
        padding: 12px;
    }

    .service-filter-chip {
        min-height: 38px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .sort-toolbar {
        flex-wrap: wrap;
    }

    .project-filter-fields,
    .calendar-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .compact-field,
    .date-range-picker,
    .date-range-picker summary,
    .project-filter-fields > .button {
        width: 100%;
    }

    .timeline-filter-form,
    .project-status-calendar-grid {
        width: 100%;
    }

    .project-status-calendar-grid {
        grid-template-columns: 1fr;
    }

    .date-range-popover {
        position: static;
        width: 100%;
        margin-top: 8px;
        box-shadow: var(--shadow-xs);
    }

    .calendar-navigation {
        flex-wrap: wrap;
    }

    .calendar-navigation h2 {
        width: 100%;
        margin: 6px 0 0;
    }

    .calendar-view-switch {
        align-self: flex-start;
    }

    .calendar-surface {
        overflow-x: auto;
    }

    .interactive-month-grid,
    .calendar-week-grid {
        min-width: 700px;
    }

    .crm-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        padding: 18px;
    }

    .project-task-admin-actions {
        justify-content: stretch;
    }

    .project-task-admin-actions > *,
    .project-task-admin-actions .button {
        width: 100%;
    }

    .chat-members-panel div.employee-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .calendar-day {
        min-height: 78px;
        padding: 6px;
    }

    .project-card-main {
        padding: 18px;
    }

    .project-card-heading {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .project-card-status {
        justify-content: space-between;
    }

    .project-card-footer {
        align-items: stretch;
        flex-direction: column;
        padding: 15px 18px;
    }

    .project-row-actions {
        width: 100%;
        margin-left: 0;
    }

    .project-row-actions .button {
        width: 100%;
    }

    .tab-list {
        top: 72px;
        margin-right: -5px;
        margin-left: -5px;
    }

    .tab-button {
        min-height: 44px;
    }

    .detail-grid,
    .service-grid,
    .client-access-columns,
    .form-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }

    dl {
        grid-template-columns: 1fr;
        gap: 0;
    }

    dt {
        padding-bottom: 2px;
        border-bottom: 0;
    }

    dd {
        padding-top: 2px;
    }

    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form .field {
        min-width: 0;
    }

    .chat-channel-header,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-message {
        width: 90%;
    }

    .copy-link-row {
        grid-template-columns: 1fr;
    }

    .copy-link-row .button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .workspace-nav-link {
        gap: 5px;
        padding-right: 9px;
        padding-left: 9px;
        font-size: 12px;
    }

    .project-filter-label {
        display: none;
    }

    .project-list-toolbar {
        top: 66px;
    }

    .chat-members-panel div.employee-choice-grid,
    .global-chat-members ul {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: 56px;
        padding: 3px;
    }

    .date-range-fields {
        grid-template-columns: 1fr;
    }

    .calendar-day time {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .brand-logo {
        width: 124px;
    }

    .card,
    .login-card {
        border-radius: 14px;
    }

    .login-card {
        padding: 26px 20px;
    }

    .project-title {
        font-size: 19px;
    }

    .tab-list {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .chat-message-list,
    .chat-compose,
    .chat-channel-header {
        padding-right: 17px;
        padding-left: 17px;
    }

    .chat-visibility-notice {
        white-space: normal;
    }

    .client-invitation-actions .button,
    .client-invitation-actions button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
