: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;
}

.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;
}

.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;
}

.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;
}

.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-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:first-of-type {
    border-top: 0;
}

.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);
}

@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;
    }
}
