:root {
    --bg: #eef3f9;
    --surface: #ffffff;
    --surface-soft: #f6f8fc;
    --ink: #18233a;
    --muted: #748096;
    --line: #dce4ef;
    --primary: #2457d6;
    --primary-dark: #1744b1;
    --primary-soft: #e9efff;
    --green: #1fa66b;
    --green-soft: #e7f7ef;
    --orange: #e68a24;
    --orange-soft: #fff3e3;
    --red: #dc4c57;
    --red-soft: #ffebed;
    --navy: #12213f;
    --shadow: 0 12px 32px rgba(29, 48, 82, 0.09);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    color-scheme: light;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
}

body {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: 100%;
    margin: 0;
    overflow: hidden !important;
    overscroll-behavior: none;
    background:
        radial-gradient(circle at 20% -10%, rgba(56, 103, 214, 0.14), transparent 34%),
        var(--bg);
    color: var(--ink);
}

button,
input,
textarea,
select {
    max-width: 100%;
    min-width: 0;
    font: inherit;
}

button {
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(36, 87, 214, 0.22);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.app-shell {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: var(--tg-viewport-height, 100dvh);
    max-height: var(--tg-viewport-height, 100dvh);
    overflow: hidden;
    flex-direction: column;
}

.app-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    min-height: calc(66px + var(--safe-top));
    padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) 12px calc(16px + var(--safe-left));
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, #12213f 0%, #1c3565 100%);
    box-shadow: 0 8px 24px rgba(12, 27, 54, 0.22);
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
}

.brand-mark svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    font-size: 17px;
    line-height: 1.2;
}

.brand-copy span {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.67);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 2px solid rgba(255, 255, 255, 0.26);
    border-radius: 50%;
    background: linear-gradient(135deg, #3e75f1, #6a4ed7);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
}

.app-main {
    display: flex;
    flex: 1 1 auto;
    width: min(100%, 720px);
    min-height: 0;
    margin: 0 auto;
    padding: 14px calc(12px + var(--safe-right)) 16px calc(12px + var(--safe-left));
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scroll-padding-block: 16px;
    flex-direction: column;
    gap: 12px;
}

.employee-switcher,
.push-card,
.week-card,
.progress-card,
.tasks-section,
.week-tasks-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid rgba(211, 222, 237, 0.9);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.employee-switcher {
    padding: 15px;
    background:
        linear-gradient(140deg, rgba(232, 240, 255, 0.96), rgba(255, 255, 255, 0.98)),
        var(--surface);
}

.employee-switcher__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.employee-switcher__head > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.employee-switcher__head strong {
    color: var(--navy);
    font-size: 16px;
}

.role-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    font-weight: 850;
}

.employee-select-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.employee-select-field > span {
    color: #68758c;
    font-size: 10px;
    font-weight: 800;
}

.employee-select-field select {
    width: 100%;
    height: 44px;
    padding: 0 11px;
    border: 1px solid #cfdbea;
    border-radius: 12px;
    background: #fff;
    color: var(--navy);
    font-size: 13px;
    font-weight: 750;
}

.employee-switcher p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.employee-reminder-setting {
    display: flex;
    width: 100%;
    margin-top: 10px;
    padding: 10px 11px;
    align-items: center;
    border: 1px solid #d6e0ed;
    border-radius: 12px;
    background: #fff;
    color: #42506a;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.35;
    gap: 9px;
    cursor: pointer;
}

.employee-reminder-setting input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--primary);
}

.employee-reminder-setting:has(input:disabled) {
    opacity: 0.55;
    cursor: wait;
}

.manager-export-button {
    display: flex;
    width: 100%;
    min-height: 42px;
    margin-top: 11px;
    padding: 9px 12px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(36, 87, 214, 0.22);
    border-radius: 12px;
    background: #fff;
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 850;
    gap: 7px;
    cursor: pointer;
}

.manager-export-button span {
    font-size: 17px;
    line-height: 1;
}

.manager-export-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.view-mode-switch {
    display: grid;
    width: 100%;
    min-width: 0;
    padding: 4px;
    border: 1px solid rgba(211, 222, 237, 0.95);
    border-radius: 15px;
    background: #e3eaf4;
    box-shadow: 0 8px 22px rgba(29, 48, 82, 0.06);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.view-mode-button {
    display: inline-flex;
    min-width: 0;
    min-height: 40px;
    padding: 8px 12px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #66758c;
    font-size: 12px;
    font-weight: 850;
    gap: 6px;
    cursor: pointer;
}

.view-mode-button span {
    font-size: 15px;
    line-height: 1;
}

.view-mode-button.is-active {
    background: linear-gradient(135deg, #2457d6, #1744b1);
    color: #fff;
    box-shadow: 0 6px 16px rgba(36, 87, 214, 0.22);
}

.task-scope-switch {
    display: flex;
    width: 100%;
    min-width: 0;
    padding: 4px;
    border: 1px solid rgba(211, 222, 237, 0.95);
    border-radius: 15px;
    background: #f1f4f8;
    box-shadow: 0 8px 22px rgba(29, 48, 82, 0.05);
    gap: 4px;
}

.task-scope-switch[hidden],
.task-scope-button[hidden] {
    display: none !important;
}

.task-scope-button {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 0;
    min-height: 38px;
    padding: 8px 7px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #66758c;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.15;
    cursor: pointer;
}

.task-scope-button.is-active {
    background: #fff;
    color: #1744b1;
    box-shadow: 0 4px 13px rgba(29, 48, 82, 0.12);
}

.task-scope-button:disabled {
    cursor: default;
}

.push-card {
    display: grid;
    padding: 12px 13px;
    align-items: center;
    background:
        linear-gradient(140deg, rgba(235, 242, 255, 0.98), rgba(255, 255, 255, 0.98)),
        var(--surface);
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
}

.push-card__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary-soft);
    font-size: 19px;
}

.push-card__copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.push-card__copy strong {
    color: var(--navy);
    font-size: 12px;
}

.push-card__copy span {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.push-card__actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.push-button,
.push-test-button {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 850;
    cursor: pointer;
}

.push-button {
    border: 0;
    background: var(--primary);
    color: #fff;
}

.push-test-button {
    border: 1px solid rgba(36, 87, 214, 0.25);
    background: #fff;
    color: var(--primary-dark);
}

.push-button:disabled,
.push-test-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.week-card,
.tasks-section,
.week-tasks-section {
    padding: 15px;
}

.section-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.section-heading > div {
    min-width: 0;
}

.section-heading h2 {
    margin: 2px 0 0;
    color: var(--navy);
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.eyebrow {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.week-navigation {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.week-card.is-week-view .week-navigation {
    margin-bottom: 0;
}

.week-navigation__copy {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

.week-navigation h2 {
    margin: 2px 0 0;
    color: var(--navy);
    font-size: 18px;
    line-height: 1.2;
}

.week-range {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.week-nav-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--navy);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.week-nav-button:active {
    transform: scale(0.96);
}

.week-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.week-day {
    display: flex;
    min-width: 0;
    width: 100%;
    min-height: 65px;
    padding: 7px 2px 5px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted);
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.week-day__name {
    color: var(--muted);
    font-size: 8px;
    font-weight: 850;
    text-transform: uppercase;
}

.week-day__number {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
}

.week-day__result {
    min-height: 10px;
    font-size: 8px;
    font-weight: 800;
}

.week-day.has-tasks .week-day__result {
    color: var(--primary);
}

.week-day.is-closed .week-day__result {
    color: var(--green);
}

.week-day.is-today:not(.is-selected) {
    border-color: rgba(36, 87, 214, 0.42);
    background: #f0f4ff;
}

.week-day.is-selected {
    border-color: var(--primary);
    background: var(--primary);
    color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 6px 14px rgba(36, 87, 214, 0.22);
}

.week-day.is-selected .week-day__name,
.week-day.is-selected .week-day__number,
.week-day.is-selected .week-day__result {
    color: #fff;
}

.current-week-button {
    display: block;
    margin: 10px auto 0;
    padding: 4px 8px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 10px;
    font-weight: 750;
    cursor: pointer;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.summary-card {
    display: flex;
    min-width: 0;
    min-height: 70px;
    padding: 10px;
    align-items: center;
    border: 1px solid rgba(211, 222, 237, 0.9);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(29, 48, 82, 0.06);
    gap: 8px;
}

.summary-card > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.summary-card strong {
    color: var(--navy);
    font-size: 20px;
    line-height: 1;
}

.summary-card span:last-child {
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-icon {
    display: grid;
    place-items: center;
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 900;
}

.summary-icon--all {
    background: var(--primary-soft);
    color: var(--primary);
}

.summary-icon--active {
    background: var(--orange-soft);
    color: var(--orange);
}

.summary-icon--done {
    background: var(--green-soft);
    color: var(--green);
}

.progress-card {
    padding: 13px 15px;
}

.progress-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.progress-copy strong {
    color: var(--navy);
    font-size: 13px;
}

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

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2457d6, #43b98a);
    transition: width 0.25s ease;
}

.add-button {
    display: inline-flex;
    min-height: 36px;
    padding: 7px 10px;
    align-items: center;
    border: 0;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
    gap: 4px;
    cursor: pointer;
}

.add-button span {
    font-size: 16px;
    line-height: 1;
}

.add-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.task-list {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 11px;
}

.week-task-count {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
}

.week-task-list {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.week-task-row {
    display: grid;
    width: 100%;
    min-width: 0;
    padding: 12px 3px;
    align-items: center;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 10px;
    text-align: left;
    cursor: pointer;
}

.week-task-row:first-child {
    border-top: 0;
}

.week-task-row.is-today {
    background: #f1f5ff;
}

.week-task-row:active {
    background: var(--primary-soft);
}

.week-task-date,
.week-task-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.week-task-date {
    gap: 2px;
}

.week-task-date strong {
    color: var(--navy);
    font-size: 13px;
}

.week-task-date span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.week-task-copy {
    gap: 4px;
}

.week-task-copy strong {
    color: var(--navy);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.week-task-details {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.week-task-status {
    max-width: 118px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #edf1f6;
    color: #5e6d83;
    font-size: 9px;
    font-weight: 850;
    overflow-wrap: anywhere;
    text-align: center;
}

.week-task-status--in_progress {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.week-task-status--done {
    background: var(--green-soft);
    color: #16784f;
}

.week-task-status--carried {
    background: var(--orange-soft);
    color: #9a5b0a;
}

.week-task-status--not_done {
    background: var(--red-soft);
    color: #9e303a;
}

.task-card {
    min-width: 0;
    padding: 13px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcfe;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.task-card:focus-within {
    border-color: rgba(36, 87, 214, 0.46);
    box-shadow: 0 8px 22px rgba(36, 87, 214, 0.09);
}

.task-card.is-done {
    border-color: #bfe8d4;
    background: #f6fcf9;
}

.task-card.is-not-done {
    border-color: #f2c9cd;
    background: #fffafb;
}

.task-card.is-read-only {
    border-color: #d6deea;
    background: #f5f7fa;
}

.task-card.is-assigned-compact {
    padding-bottom: 14px;
}

.task-card.is-assigned-compact .task-card__head {
    margin-bottom: 9px;
}

.task-card.is-assigned-compact .task-status-field {
    margin-top: 9px;
}

.task-recurrence-summary {
    display: flex;
    min-width: 0;
    margin-top: 9px;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.task-recurrence-badge {
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eeeaff;
    color: #6346b5;
    font-size: 9px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.task-recurrence-stop {
    min-height: 28px;
    padding: 4px 7px;
    border: 1px solid #e1d9f8;
    border-radius: 9px;
    background: #fff;
    color: #6f55a9;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
}

.task-recurrence-stop:disabled {
    opacity: 0.45;
}

.task-card__head {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
}

.task-number {
    display: grid;
    place-items: center;
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    border-radius: 9px;
    background: var(--navy);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.task-card__spacer {
    flex: 1 1 auto;
}

.remove-button {
    display: grid;
    place-items: center;
    flex: 0 0 31px;
    width: 31px;
    height: 31px;
    border: 0;
    border-radius: 10px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 19px;
    cursor: pointer;
}

.remove-button:disabled {
    opacity: 0.35;
}

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.field + .field,
.task-timestamps + .field {
    margin-top: 10px;
}

.field label,
.field > span {
    color: #68758c;
    font-size: 10px;
    font-weight: 800;
}

.field input,
.field textarea,
.field select {
    display: block;
    width: 100%;
    min-width: 0;
    border: 1px solid #d9e1ec;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
}

.field input,
.field select {
    height: 42px;
    padding: 0 11px;
}

.field textarea {
    min-height: 70px;
    max-height: 170px;
    padding: 10px 11px;
    overflow-y: auto;
    line-height: 1.4;
    resize: vertical;
}

.task-schedule-grid {
    display: grid;
    min-width: 0;
    margin-top: 10px;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 8px;
}

.task-schedule-grid .field {
    min-width: 0;
}

.task-schedule-grid .field + .field {
    margin-top: 0;
}

.task-schedule-grid .task-reminder-field,
.task-schedule-grid .task-recurrence-field,
.task-schedule-grid .task-recurrence-until-field {
    grid-column: 1 / -1;
}

.task-schedule-grid input[type="time"],
.task-schedule-grid input[type="date"] {
    inline-size: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.task-schedule-hint,
.task-carry-hint {
    margin: 6px 1px 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
}

.task-carry-hint {
    padding: 6px 8px;
    border-radius: 9px;
    background: #fff4e3;
    color: #9a5b0a;
    font-weight: 750;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #a9b2c1;
}

.field input:disabled,
.field textarea:disabled,
.field select:disabled {
    opacity: 1;
    background: #f1f4f8;
    color: #68758c;
    -webkit-text-fill-color: #68758c;
}

.task-timestamps {
    display: flex;
    margin-top: 9px;
    flex-wrap: wrap;
    gap: 5px;
}

.task-timestamp {
    max-width: 100%;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eef3fb;
    color: #5f6f88;
    font-size: 9px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.task-timestamp--status {
    background: var(--green-soft);
    color: #16784f;
}

.status-select[data-status="planned"] {
    color: #5e6d83;
}

.status-select[data-status="in_progress"] {
    color: var(--primary);
}

.status-select[data-status="done"] {
    color: var(--green);
}

.status-select[data-status="carried"] {
    color: var(--orange);
}

.status-select[data-status="not_done"] {
    color: var(--red);
}

.empty-state {
    padding: 25px 14px;
    border: 1px dashed #cbd6e5;
    border-radius: 16px;
    background: var(--surface-soft);
    text-align: center;
}

.empty-state__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: 15px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 24px;
}

.empty-state strong {
    display: block;
    color: var(--navy);
    font-size: 16px;
}

.empty-state p {
    margin: 6px auto 13px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.action-bar {
    position: relative;
    z-index: 20;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 11px calc(12px + var(--safe-right)) calc(9px + var(--safe-bottom)) calc(12px + var(--safe-left));
    overflow: hidden;
    border-top: 1px solid rgba(206, 218, 233, 0.94);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -10px 28px rgba(29, 48, 82, 0.1);
    backdrop-filter: blur(14px);
}

/* Во время набора текста над клавиатурой остаётся активное поле, а не кнопки. */
body.is-text-entry-active .action-bar {
    display: none !important;
}

body.is-text-entry-active .task-title:focus,
body.is-text-entry-active .task-note:focus {
    scroll-margin-block: 16px;
}

.action-bar__content {
    display: grid;
    width: min(100%, 696px);
    margin: 0 auto;
    grid-template-columns: minmax(0, 0.76fr) minmax(0, 1.24fr);
    gap: 8px;
}

.button {
    min-width: 0;
    min-height: 44px;
    padding: 10px 13px;
    border: 0;
    border-radius: 13px;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.button:active {
    transform: scale(0.98);
}

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

.button--primary {
    background: linear-gradient(135deg, #2457d6, #1744b1);
    color: #fff;
    box-shadow: 0 8px 20px rgba(36, 87, 214, 0.24);
}

.button--secondary,
.button--soft {
    border: 1px solid var(--line);
    background: #f5f7fb;
    color: var(--navy);
}

.button--soft {
    min-height: 39px;
}

.action-caption {
    width: min(100%, 696px);
    margin: 6px auto 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-login {
    position: fixed;
    z-index: 140;
    inset: 0;
    display: grid;
    min-height: 100%;
    padding: calc(22px + var(--safe-top)) calc(16px + var(--safe-right)) calc(22px + var(--safe-bottom)) calc(16px + var(--safe-left));
    place-items: center;
    overflow-y: auto;
    background:
        radial-gradient(circle at 12% 10%, rgba(77, 126, 242, 0.2), transparent 34%),
        linear-gradient(155deg, #12213f 0%, #1d3767 58%, #2557d1 125%);
    -webkit-overflow-scrolling: touch;
}

.app-login[hidden] {
    display: none;
}

.app-login__card {
    width: min(100%, 410px);
    padding: 27px 21px 20px;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 26px 68px rgba(5, 15, 35, 0.36);
}

.app-login__icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #2457d6, #1744b1);
    color: #fff;
    box-shadow: 0 12px 25px rgba(36, 87, 214, 0.25);
    font-size: 28px;
    font-weight: 900;
}

.app-login__card h1 {
    margin: 4px 0 0;
    color: var(--navy);
    font-size: 24px;
    line-height: 1.2;
}

.app-login__lead {
    margin: 10px 0 14px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.app-login__steps {
    margin: 0 0 17px;
    padding: 13px 13px 13px 35px;
    border: 1px solid #dce5f3;
    border-radius: 14px;
    background: #f6f9ff;
    color: #53627a;
    font-size: 11px;
    line-height: 1.65;
}

.app-login__steps code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #e5edff;
    color: var(--primary-dark);
    font-family: inherit;
    font-weight: 900;
}

.app-login__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-login__field span {
    color: #68758c;
    font-size: 10px;
    font-weight: 850;
}

.app-login__field input {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border: 1px solid #cfdbea;
    border-radius: 14px;
    outline: none;
    background: #fff;
    color: var(--navy);
    font-size: 20px;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-align: center;
}

.app-login__field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.12);
}

.app-login__error {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--red-soft);
    color: #9e303a;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.4;
}

.app-login__button {
    width: 100%;
    min-height: 48px;
    margin-top: 13px;
}

.app-login__note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
    text-align: center;
}

.app-login__privacy {
    margin: 8px 0 0;
    font-size: 9px;
    text-align: center;
}

.app-login__privacy a {
    color: var(--primary-dark);
    text-underline-offset: 2px;
}

.loading-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(238, 243, 249, 0.92);
    color: var(--navy);
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(5px);
}

.loading-overlay[hidden] {
    display: none;
}

.loading-overlay strong {
    font-size: 13px;
}

.spinner {
    width: 35px;
    height: 35px;
    border: 3px solid #d6dfec;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.72s linear infinite;
}

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

.toast {
    position: fixed;
    z-index: 120;
    left: 50%;
    bottom: calc(92px + var(--safe-bottom));
    width: min(calc(100% - 24px), 520px);
    padding: 11px 14px;
    opacity: 0;
    border-radius: 13px;
    background: #18233a;
    color: #fff;
    box-shadow: 0 12px 28px rgba(14, 25, 47, 0.24);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    pointer-events: none;
    transform: translate(-50%, 14px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.is-error {
    background: #a92f3a;
}

.toast.is-warning {
    background: #9a5a13;
}

.modal-backdrop {
    position: fixed;
    z-index: 110;
    inset: 0;
    display: grid;
    place-items: center;
    max-width: 100%;
    padding: 18px calc(18px + var(--safe-right)) 18px calc(18px + var(--safe-left));
    overflow: hidden;
    background: rgba(12, 25, 48, 0.58);
    backdrop-filter: blur(5px);
}

.confirm-modal {
    width: min(100%, 390px);
    min-width: 0;
    max-width: 100%;
    padding: 23px 19px 18px;
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(7, 19, 42, 0.32);
    text-align: center;
}

.confirm-modal__icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 25px;
    font-weight: 900;
}

.confirm-modal h2 {
    margin: 0;
    color: var(--navy);
    font-size: 20px;
}

.confirm-modal p {
    margin: 9px 0 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.finish-status-warning {
    margin: -7px 0 16px;
    padding: 10px 11px;
    border: 1px solid #f0c5ca;
    border-radius: 12px;
    background: var(--red-soft);
    color: #9e303a;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.4;
}

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

.tool-modal {
    width: min(100%, 430px);
    min-width: 0;
    max-width: 100%;
    max-height: min(90dvh, 680px);
    padding: 20px 18px 18px;
    overflow-y: auto;
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(7, 19, 42, 0.32);
    -webkit-overflow-scrolling: touch;
}

.tool-modal__head {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.tool-modal__head h2 {
    margin: 3px 0 0;
    color: var(--navy);
    font-size: 20px;
    line-height: 1.2;
}

.modal-close-button {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 11px;
    background: #f1f4f8;
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
}

.modal-close-button:disabled {
    opacity: 0.4;
}

.tool-modal__hint {
    margin: 10px 0 15px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.tool-field {
    display: flex;
    min-width: 0;
    margin-top: 13px;
    flex-direction: column;
    gap: 5px;
}

.tool-field > span {
    color: #68758c;
    font-size: 10px;
    font-weight: 800;
}

.tool-field input {
    width: 100%;
    min-width: 0;
    height: 43px;
    padding: 0 11px;
    border: 1px solid #d9e1ec;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
}

.export-actions {
    display: grid;
    margin-top: 15px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.export-date-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    min-width: 0;
    max-width: 100%;
}

.export-date-grid > * {
    min-width: 0;
}

.export-date-grid .tool-field {
    margin-top: 0;
}

.export-scope-card {
    display: flex;
    min-width: 0;
    margin-top: 13px;
    padding: 11px 12px;
    border: 1px solid #dce5f3;
    border-radius: 12px;
    background: #f6f9ff;
    flex-direction: column;
    gap: 3px;
}

.export-scope-card span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.export-scope-card strong {
    overflow: hidden;
    color: var(--navy);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-limit-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
    text-align: center;
}

@media (max-width: 430px) {
    .app-main {
        padding-right: calc(9px + var(--safe-right));
        padding-left: calc(9px + var(--safe-left));
    }

    .employee-switcher,
    .push-card,
    .week-card,
    .tasks-section,
    .week-tasks-section {
        border-radius: 17px;
    }

    .week-card,
    .tasks-section,
    .week-tasks-section {
        padding: 12px;
    }

    .push-card {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .push-card__icon {
        width: 34px;
        height: 34px;
    }

    .push-card__actions {
        grid-column: 2;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .week-strip {
        gap: 2px;
    }

    .week-day {
        padding-inline: 0;
    }

    .summary-card {
        padding: 8px 6px;
        gap: 5px;
    }

    .summary-icon {
        flex-basis: 25px;
        width: 25px;
        height: 25px;
    }

    .summary-card strong {
        font-size: 18px;
    }

    .week-task-row {
        align-items: start;
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 8px;
    }

    .week-task-status {
        max-width: 100%;
        grid-column: 2;
        justify-self: start;
    }

    .action-bar {
        padding-right: calc(9px + var(--safe-right));
        padding-left: calc(9px + var(--safe-left));
    }

    .tool-modal {
        padding-inline: 15px;
    }

    .export-date-grid,
    .export-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .task-schedule-grid {
        grid-template-columns: 1fr;
    }
}

/* WKWebView увеличивает страницу при фокусе на поле со шрифтом меньше 16 px. */
@supports (-webkit-touch-callout: none) {
    .employee-select-field select,
    .field input,
    .field textarea,
    .field select,
    .tool-field input {
        font-size: 16px;
    }

    input[type="date"] {
        min-width: 0;
        max-width: 100%;
        inline-size: 100%;
    }
}

@media (max-width: 340px) {
    .week-navigation {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        gap: 6px;
    }

    .week-nav-button {
        width: 34px;
    }

    .summary-grid {
        gap: 5px;
    }

    .summary-card {
        padding-inline: 5px;
    }
}

@media (min-width: 680px) {
    .app-main {
        padding-top: 20px;
        gap: 15px;
    }

    .employee-switcher,
    .push-card,
    .week-card,
    .tasks-section,
    .week-tasks-section {
        padding: 20px;
    }
}

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