:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --line: #dfe1e6;
    --line-strong: #c1c7d0;
    --text: #172b4d;
    --muted: #5e6c84;
    --blue: #0052cc;
    --blue-dark: #0747a6;
    --blue-soft: #deebff;
    --green: #00875a;
    --green-soft: #e3fcef;
    --red: #de350b;
    --red-soft: #ffebe6;
    --yellow: #ffab00;
    --shadow: 0 8px 24px rgba(9, 30, 66, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

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

.app-shell {
    width: min(1840px, calc(100vw - 48px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar,
.section-head,
.control-row,
.topbar-actions {
    display: flex;
    align-items: center;
}

.topbar {
    justify-content: space-between;
    min-height: 72px;
    margin-bottom: 18px;
}

.topbar h1,
.section-head h2 {
    margin: 0;
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.2;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.topbar-actions,
.control-row {
    gap: 10px;
}

.user-email {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    padding: 18px;
}

.section-head {
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-head h2 {
    font-size: 18px;
}

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

.button,
.icon-task-button {
    align-items: center;
    border: 1px solid var(--blue);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    gap: 7px;
    justify-content: center;
    min-height: 36px;
    padding: 7px 12px;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.button {
    background: var(--blue);
    color: #ffffff;
    text-decoration: none;
}

.button:hover,
.icon-task-button:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

.button-secondary {
    background: #ffffff;
    color: var(--blue);
}

.button-secondary:hover {
    color: #ffffff;
}

.button.is-active {
    background: var(--red-soft);
    border-color: var(--red);
    color: var(--red);
}

.button.is-active:hover,
.button-danger {
    background: var(--red);
    border-color: var(--red);
    color: #ffffff;
}

.button-danger:hover {
    background: #bf2600;
    border-color: #bf2600;
}

.button:disabled,
.icon-task-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.text-control,
.select-control,
.date-input,
.field-input {
    background: #ffffff;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--text);
    min-height: 36px;
    padding: 7px 9px;
    width: 100%;
}

.text-control:focus,
.select-control:focus,
.date-input:focus,
.field-input:focus,
.status-body:focus {
    border-color: var(--blue);
    outline: 2px solid var(--blue-soft);
}

.team-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.team-chip {
    background: #ffffff;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    min-height: 36px;
    padding: 7px 14px;
}

.team-chip.is-selected {
    background: var(--blue-soft);
    border-color: var(--blue);
    box-shadow: inset 4px 0 0 var(--blue);
}

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

.task-item {
    align-items: center;
    background: #fafbfc;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 180px 48px;
    min-height: 48px;
    padding: 8px 10px;
}

.task-item strong {
    color: var(--blue-dark);
}

.task-meta {
    color: var(--muted);
    font-size: 13px;
}

.icon-task-button {
    background: var(--blue);
    color: #ffffff;
    min-width: 38px;
    padding: 7px 9px;
}

.status-grid {
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}

.grid-header,
.grid-row {
    display: grid;
    grid-template-columns: 1.1fr 1.2fr minmax(560px, 3.4fr) 130px 130px 130px;
}

.grid-header {
    background: #f1f2f4;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.grid-header > div,
.grid-cell {
    border-right: 1px solid var(--line);
    padding: 10px;
}

.grid-header > div:last-child,
.grid-cell:last-child {
    border-right: 0;
}

.sort-header {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    font-size: inherit;
    font-weight: inherit;
    gap: 6px;
    justify-content: space-between;
    line-height: inherit;
    min-height: 0;
    padding: 0;
    text-align: left;
    text-transform: inherit;
    width: 100%;
}

.sort-header:hover,
.sort-header:focus-visible,
.sort-header.is-active {
    color: var(--blue-dark);
}

.sort-header:focus-visible {
    outline: 2px solid var(--blue-soft);
    outline-offset: 2px;
}

.sort-header i {
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 12px;
}

.sort-header.is-active i {
    color: var(--blue);
}

.grid-row {
    min-height: 138px;
    border-top: 1px solid var(--line);
}

.grid-empty {
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 18px;
}

.grid-row.is-complete {
    background: #f7f8f9;
}

.grid-row.is-removable {
    cursor: pointer;
    position: relative;
}

.grid-row.is-removable::before {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--red);
    border-radius: 4px;
    color: var(--red);
    content: "\f2ed";
    display: inline-flex;
    font-family: "Font Awesome 6 Free";
    font-size: 13px;
    font-weight: 900;
    height: 24px;
    justify-content: center;
    left: 10px;
    position: absolute;
    top: 10px;
    width: 24px;
    z-index: 1;
}

.grid-row.is-removable:hover {
    background: var(--red-soft);
}

.grid-row.is-removable .grid-cell:first-child {
    padding-left: 42px;
}

.grid-row.is-removable:hover .grid-cell:first-child {
    box-shadow: inset 4px 0 0 var(--red);
}

.field-input {
    border-color: transparent;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    overflow-wrap: anywhere;
    padding-left: 0;
    resize: none;
    white-space: pre-wrap;
}

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

.date-picker {
    background: #ffffff;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    box-shadow: var(--shadow);
    padding: 8px;
    position: fixed;
    width: 238px;
    z-index: 30;
}

.date-picker[hidden] {
    display: none;
}

.date-picker-header {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: 32px 1fr 32px;
    margin-bottom: 8px;
}

.date-picker-label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.date-picker-nav,
.date-picker-day {
    align-items: center;
    background: #ffffff;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 30px;
    padding: 0;
}

.date-picker-nav {
    color: var(--blue);
    font-weight: 700;
}

.date-picker-nav:hover,
.date-picker-day:hover {
    background: var(--blue-soft);
    border-color: var(--blue);
}

.date-picker-grid {
    display: grid;
    gap: 3px;
    grid-template-columns: repeat(7, 1fr);
}

.date-picker-weekday {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}

.date-picker-empty {
    min-height: 30px;
}

.date-picker-day.is-today {
    border-color: var(--line-strong);
    font-weight: 700;
}

.date-picker-day.is-selected {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
    font-weight: 700;
}

.date-input.tracked-date.is-future {
    background: var(--green-soft);
    border-color: var(--green);
    color: var(--green);
    font-weight: 700;
}

.date-input.tracked-date.is-past {
    background: var(--red-soft);
    border-color: var(--red);
    color: var(--red);
    font-weight: 700;
}

.status-cell {
    position: relative;
}

.status-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.status-update {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    grid-template-columns: 92px 1fr;
    padding: 8px 0;
}

.status-update.is-removable {
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    margin: 2px 0;
    padding: 8px 6px 8px 34px;
    position: relative;
}

.status-update.is-removable::before {
    align-items: center;
    color: var(--red);
    content: "\f2ed";
    display: inline-flex;
    font-family: "Font Awesome 6 Free";
    font-size: 13px;
    font-weight: 900;
    height: 24px;
    justify-content: center;
    left: 6px;
    position: absolute;
    top: 8px;
    width: 20px;
}

.status-update.is-removable:hover {
    background: var(--red-soft);
    border-color: var(--red);
}

.status-update:first-of-type {
    border-top: 0;
}

.status-update.is-removable:first-of-type {
    border-top: 1px solid transparent;
}

.status-update.is-removable:hover:first-of-type {
    border-top-color: var(--red);
}

.status-date {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.status-body {
    border: 1px solid transparent;
    border-radius: 4px;
    min-height: 26px;
    padding: 2px 4px;
    white-space: pre-wrap;
}

.task-fragment {
    border-radius: 3px;
    font-weight: 700;
    padding: 1px 2px;
}

.task-fragment.open {
    background: var(--red-soft);
    color: var(--red);
}

.task-fragment.complete {
    background: var(--green-soft);
    color: var(--green);
}

.toast {
    background: var(--text);
    border-radius: 4px;
    bottom: 22px;
    color: #ffffff;
    left: 50%;
    max-width: 520px;
    opacity: 0;
    padding: 10px 14px;
    pointer-events: none;
    position: fixed;
    transform: translate(-50%, 12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 20;
}

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

.modal-backdrop {
    align-items: center;
    background: rgba(9, 30, 66, 0.38);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 20px;
    position: fixed;
    z-index: 40;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 420px;
    padding: 20px;
    width: min(100%, 420px);
}

.modal h2 {
    font-size: 18px;
    line-height: 1.25;
    margin: 0 0 8px;
}

.modal p {
    color: var(--muted);
    margin: 0 0 18px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 1180px) {
    .app-shell {
        width: calc(100vw - 28px);
    }

    .grid-header,
    .grid-row {
        grid-template-columns: 170px 190px minmax(420px, 1fr) 112px 112px 112px;
    }

    .status-grid {
        overflow-x: auto;
    }

    .grid-header,
    .grid-row {
        min-width: 1116px;
    }
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .control-row {
        flex-wrap: wrap;
    }
}
