:root {
    color-scheme: light;
    --navy: #172b4d;
    --blue: #0c66e4;
    --blue-hover: #0055cc;
    --surface: #ffffff;
    --canvas: #0b66c3;
    --list: #f1f2f4;
    --line: #dcdfe4;
    --text: #172b4d;
    --muted: #626f86;
    --danger: #c9372c;
    --shadow: 0 2px 8px rgba(9, 30, 66, .18);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: #f7f8fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

input, textarea {
    width: 100%;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid #8590a2;
    border-radius: 6px;
}

input:focus, textarea:focus {
    border-color: var(--blue);
    outline: 2px solid rgba(12, 102, 228, .18);
}

textarea { resize: vertical; }
.hidden { display: none !important; }

.topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 8px 20px;
    color: white;
    background: var(--navy);
}

.brand {
    color: white;
    font-size: 20px;
    font-weight: 800;
    text-decoration: none;
}

.topbar-actions { display: flex; align-items: center; gap: 14px; }
.sync-state { color: #d7e0ef; font-size: 13px; }
.board-switcher {
    width: min(240px, 28vw);
    min-height: 36px;
    padding: 6px 30px 6px 10px;
    color: var(--navy);
    background: white;
    border: 0;
    border-radius: 6px;
    font-weight: 700;
}

.home {
    display: grid;
    min-height: calc(100vh - 54px);
    padding: 40px 20px;
    place-items: center;
    background: linear-gradient(145deg, #eef6ff 0%, #f9fbff 50%, #edf0ff 100%);
}

.home-content { width: min(920px, 100%); }
.home-account {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}

.hero-card {
    width: 100%;
    padding: 48px;
    background: var(--surface);
    border: 1px solid #e5e8ed;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(9, 30, 66, .12);
}

.hero-card h1 { margin: 4px 0 12px; font-size: clamp(30px, 5vw, 46px); line-height: 1.2; }
.hero-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.eyebrow { margin: 0; color: var(--blue); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hero-card .stack { margin-top: 28px; }
.my-boards {
    margin-top: 20px;
    padding: 24px;
    background: white;
    border: 1px solid #e5e8ed;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(9, 30, 66, .08);
}

.my-boards h2 { margin: 0 0 16px; font-size: 20px; }
.board-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.board-choice {
    display: flex;
    min-height: 96px;
    padding: 16px;
    color: white;
    background: linear-gradient(135deg, #0c66e4, #0747a6);
    border-radius: 10px;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
}
.board-choice:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.board-choice span { color: #d9e9ff; font-size: 12px; }
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row.compact { width: min(420px, 100%); }

.button {
    min-height: 38px;
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    font-weight: 700;
    white-space: nowrap;
}

.button:disabled { cursor: wait; opacity: .6; }
.button-primary { color: white; background: var(--blue); }
.button-primary:hover { background: var(--blue-hover); }
.button-secondary { color: var(--navy); background: #e9edf3; }
.button-danger { color: white; background: var(--danger); }
.button-ghost { color: var(--muted); background: transparent; }
.button-ghost:hover { color: var(--text); background: #dfe1e6; }

.board-view {
    min-height: calc(100vh - 54px);
    background: var(--canvas);
}

.board-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px 16px;
    color: white;
}

.board-heading .eyebrow { color: #cce3ff; }
.board-heading h1 { margin: 3px 0 0; font-size: 24px; }

.board-canvas {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-height: calc(100vh - 143px);
    padding: 0 24px 28px;
    overflow-x: auto;
}

.task-list {
    flex: 0 0 290px;
    max-height: calc(100vh - 175px);
    padding: 10px;
    overflow-y: auto;
    background: var(--list);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 4px 9px;
}

.list-header h2 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.icon-button { padding: 4px 8px; color: var(--muted); background: transparent; border: 0; border-radius: 5px; font-size: 20px; }
.icon-button:hover { background: #dfe1e6; }
.card-list { min-height: 8px; }

.task-card {
    margin-bottom: 8px;
    padding: 11px 12px;
    background: white;
    border: 1px solid rgba(9, 30, 66, .08);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(9, 30, 66, .16);
    cursor: pointer;
}

.task-card:hover { border-color: var(--blue); }
.task-card.dragging { opacity: .45; transform: rotate(2deg); }
.task-card h3 { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.card-meta span { padding: 3px 6px; background: #f1f2f4; border-radius: 4px; }
.card-meta .overdue { color: #ae2e24; background: #ffedeb; }
.assignee-summary { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.add-card-form { display: flex; gap: 4px; margin-top: 5px; }
.add-card-form input { padding: 8px; border-color: transparent; background: transparent; }
.add-card-form input:focus { background: white; border-color: var(--blue); }
.empty-list-hint { flex: 0 0 250px; padding: 14px; color: white; background: rgba(0, 0, 0, .14); border-radius: 10px; font-size: 13px; }

.modal {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: grid;
    padding: 24px;
    overflow-y: auto;
    background: rgba(9, 30, 66, .58);
    place-items: start center;
}

.modal-card {
    position: relative;
    width: min(680px, 100%);
    margin: 30px 0;
    padding: 28px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(9, 30, 66, .35);
}

.modal-small { width: min(430px, 100%); margin-top: 12vh; }
.modal-card h2 { margin-top: 0; }
.modal-close { position: absolute; top: 12px; right: 14px; }
fieldset { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.assignee-options { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check-label { display: flex; align-items: center; gap: 6px; }
.check-label input { width: auto; }
.form-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 5px; }

.comments { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.comments h3 { margin-top: 0; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment p { margin: 6px 0 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-header { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.comment-header time, .muted { color: var(--muted); }

.toast {
    position: fixed;
    z-index: 40;
    right: 20px;
    bottom: 20px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px 16px;
    color: white;
    background: #1f845a;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.toast-error { background: var(--danger); }

.activity-panel {
    position: fixed;
    z-index: 30;
    top: 0;
    right: 0;
    width: min(390px, 100vw);
    height: 100vh;
    padding: 18px;
    overflow-y: auto;
    background: white;
    box-shadow: -8px 0 28px rgba(9, 30, 66, .28);
}

.activity-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.activity-heading h2 { margin: 0; font-size: 20px; }
.activity-item { padding: 13px 2px; border-bottom: 1px solid var(--line); }
.activity-item p { margin: 4px 0; font-size: 14px; overflow-wrap: anywhere; }
.activity-item time { color: var(--muted); font-size: 12px; }
.modal-card label { display: flex; flex-direction: column; gap: 5px; }

@media (max-width: 700px) {
    .topbar { align-items: flex-start; padding: 10px 12px; }
    .topbar-actions { align-items: flex-end; flex-direction: column-reverse; gap: 4px; }
    .topbar-actions .button { min-height: 32px; padding: 5px 8px; font-size: 12px; }
    .board-switcher { width: min(210px, 62vw); }
    .sync-state { display: none; }
    .hero-card { padding: 28px 22px; }
    .input-row { align-items: stretch; flex-direction: column; }
    .board-heading { align-items: stretch; flex-direction: column; padding: 16px; }
    .board-canvas { min-height: calc(100vh - 205px); padding: 0 16px 20px; }
    .task-list { flex-basis: min(84vw, 290px); max-height: calc(100vh - 230px); }
    .modal { padding: 10px; }
    .modal-card { margin: 10px 0; padding: 22px 18px; }
    .comments .input-row { flex-direction: row; }
}
