:root {
    --bg: #f7f8fa;
    --panel: #ffffff;
    --panel-2: #f7f8fa;
    --line: #edf0f3;
    --line-soft: #f3f5f7;
    --text: #1f2933;
    --muted: #667085;
    --green: #f3f4f6;
    --green-2: #4b5563;
    --yellow: #b7791f;
    --red: #c53030;
    --focus: #3b82f6;
    --button: #f7f8fa;
    --button-hover: #eceff3;
    color-scheme: light;
    font-family: "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    border: 1px solid var(--line);
    background: var(--button);
    color: var(--text);
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

button:hover,
button:focus-visible {
    border-color: #9aa4b2;
    background: var(--button-hover);
    outline: none;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    min-height: 32px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    border-radius: 5px;
    padding: 6px 8px;
}

input:focus-visible,
[contenteditable="true"]:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.shell {
    min-height: 100vh;
}

.auth-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(360px, 100%);
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 18px 45px rgba(31, 41, 51, 0.13);
}

.auth-card h1,
.topbar h1,
.members-panel h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 650;
}

.auth-card p,
.topbar p,
.message {
    margin: 8px 0 16px;
    color: var(--muted);
}

.auth-card label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
}

.auth-card button {
    width: 100%;
    margin-top: 12px;
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
}

.auth-card button:hover,
.auth-card button:focus-visible {
    background: #1d4ed8;
    border-color: #1e40af;
}

.message {
    min-height: 20px;
    color: var(--red);
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #c8dcff;
    background: #e7f0ff;
    box-shadow: 0 1px 8px rgba(37, 99, 235, 0.10);
}

.topbar p {
    margin: 3px 0 0;
    font-size: 13px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.board-wrap {
    overflow: auto;
    height: calc(100vh - 62px);
    background: #ffffff;
}

.board {
    width: 100%;
    min-width: 1180px;
    border-collapse: separate;
    table-layout: fixed;
    border-spacing: 0;
    background: var(--panel);
}

.board th,
.board td {
    border: 0;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}

.board th:last-child,
.board td:last-child {
    border-right: 0;
}

.date-head,
.day-cell {
    width: 110px;
    min-width: 110px;
    background: #ffffff;
}

.member-head {
    height: 34px;
    text-align: left;
    padding: 7px 8px;
    background: #ffffff;
    color: var(--text);
    font-weight: 700;
    border-top: 0 !important;
}

.date-head {
    padding: 7px 8px;
    text-align: left;
    color: var(--muted);
    font-weight: 700;
}

.day-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    padding: 9px 8px;
    color: var(--text);
    border-right-color: var(--line) !important;
}

.day-cell strong,
.day-cell span {
    display: block;
}

.day-cell span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.task-cell {
    position: relative;
    width: 260px;
    height: auto;
    min-height: 88px;
    padding: 0 0 39px;
    background: #ffffff;
}

tbody tr {
    height: auto;
}

tbody tr:nth-child(even) .task-cell {
    background: #ffffff;
}

.task-list {
    min-height: 52px;
    padding: 5px 5px 2px;
}

.task-list.is-drop-target,
.task.is-drop-target {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
}

.task {
    display: grid;
    grid-template-columns: 18px 1fr 22px;
    align-items: start;
    gap: 5px;
    min-height: 26px;
    margin-bottom: 6px;
    padding: 6px 7px;
    border: 0;
    border-left: 4px solid #4b5563;
    background: #f3f4f6;
    color: #27313d;
    border-radius: 6px;
    box-shadow: none;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}


.task.is-hit-test-hidden {
    pointer-events: none;
}

.task.is-touch-dragging {
    transform: scale(0.985);
}

.task:active {
    cursor: grabbing;
}

.task.is-dragging {
    opacity: 0.45;
}

.task.is-done {
    background: #ffffff;
    border-color: #d4dae2;
}

.task.is-done .task-text {
    text-decoration: line-through;
    color: #667085;
}

.task input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: #4b5563;
}

.task-text {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.32;
}

.task-delete {
    width: 22px;
    min-height: 22px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    color: #7b8794;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease;
}

.task:hover .task-delete,
.task:focus-within .task-delete,
.task.is-active .task-delete {
    opacity: 1;
    pointer-events: auto;
}

.task-delete:hover,
.task-delete:focus-visible {
    color: var(--red);
    border-color: #feb2b2;
    background: #fff5f5;
}

.task-cell .quick-input[type="text"] {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    display: block;
    width: auto;
    min-height: 27px;
    margin: 0;
    border-color: transparent;
    background: rgba(243, 244, 246, 0.62);
    color: var(--text);
    box-shadow: none;
}

.task-cell .quick-input[type="text"]:hover {
    border-color: #c7ced8;
    background: #ffffff;
}

.task-cell .quick-input[type="text"]:focus-visible {
    border-color: var(--focus);
    background: #ffffff;
    outline: 2px solid rgba(59, 130, 246, 0.18);
    outline-offset: 0;
}

.task-cell .quick-input::placeholder {
    color: #9aa4b2;
}

.members-panel {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 10;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 96px);
    overflow: auto;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 16px 40px rgba(31, 41, 51, 0.18);
}

.panel-head,
.panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.panel-actions {
    margin-top: 10px;
    justify-content: flex-end;
}

.members-list {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}

.member-row {
    display: grid;
    grid-template-columns: 28px 1fr 44px 32px 32px;
    gap: 6px;
    align-items: center;
}

.member-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    justify-self: center;
    accent-color: #4b5563;
}

.member-row input[type="color"] {
    width: 42px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    background: transparent;
    border-radius: 5px;
}

.member-row button {
    min-height: 32px;
    padding: 0;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 20;
    margin: 0;
    max-width: min(520px, calc(100vw - 32px));
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(31, 41, 51, 0.18);
}

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

    .toolbar {
        justify-content: flex-start;
    }

    .board-wrap {
        height: calc(100vh - 118px);
    }
}
