:root {
    color-scheme: light;
    --nav: #1d2125;
    --board-bar: rgba(22, 31, 36, 0.76);
    --canvas: #838c91;
    --list: #ebecf0;
    --card: #ffffff;
    --ink: #172b4d;
    --muted: #5e6c84;
    --line: rgba(9, 30, 66, 0.14);
    --primary: #0c66e4;
    --primary-dark: #0055cc;
    --danger: #c9372c;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    padding: 9px 10px;
}

textarea {
    resize: vertical;
}

.global-nav {
    align-items: center;
    background: var(--nav);
    color: #ffffff;
    display: flex;
    gap: 12px;
    height: 48px;
    padding: 8px 12px;
}

.brand {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
}

.brand-mark {
    align-items: center;
    background: #ffffff;
    border-radius: 5px;
    color: var(--nav);
    display: inline-flex;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.nav-search {
    flex: 1 1 auto;
    max-width: 700px;
}

.nav-search + .nav-button {
    margin-left: auto;
}

.nav-search input {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    height: 32px;
}

.nav-search input::placeholder {
    color: rgba(255, 255, 255, 0.82);
}

.nav-button {
    align-items: center;
    background: rgba(255, 255, 255, 0.14);
    border: 0;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    height: 32px;
    padding: 0 12px;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.24);
}

.flash {
    background: #fff7ed;
    border-radius: 8px;
    color: #9a3412;
    left: 50%;
    max-width: 760px;
    padding: 12px 16px;
    position: fixed;
    top: 58px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    z-index: 20;
}

.auth-page {
    background: #f4f6fb;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(23, 32, 51, 0.12);
    display: grid;
    gap: 16px;
    padding: 28px;
    width: min(420px, 100%);
}

.auth-card h1 {
    margin: 0;
}

.auth-card label {
    color: var(--muted);
    display: grid;
    font-weight: 700;
    gap: 8px;
}

.auth-switch {
    color: var(--muted);
    margin: 0;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: underline;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.button {
    align-items: center;
    background: var(--primary);
    border: 0;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
}

.button:hover {
    background: var(--primary-dark);
}

.button.subtle {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.app-shell .button.subtle {
    background: #e8eefc;
    color: var(--primary);
}

.button.danger {
    background: #fee2e2;
    color: var(--danger);
}

.trello-shell {
    display: grid;
    grid-template-rows: 56px 1fr;
    height: calc(100vh - 48px);
    overflow: hidden;
}

.board-bar {
    align-items: center;
    background: var(--board-bar);
    color: #ffffff;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 10px 16px;
}

.board-bar h1 {
    font-size: 20px;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.board-switcher select {
    background: rgba(255, 255, 255, 0.16);
    border: 0;
    color: #ffffff;
    height: 36px;
    min-width: 190px;
}

.board-switcher option {
    color: var(--ink);
}

.board {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 14px 22px;
}

.column {
    background: var(--list);
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(9, 30, 66, 0.18);
    display: flex;
    flex: 0 0 272px;
    flex-direction: column;
    max-height: 100%;
    padding: 8px;
    width: 272px;
}

.add-column {
    background: rgba(235, 236, 240, 0.72);
}

.add-column form {
    display: grid;
    gap: 8px;
}

.column-header {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-height: 36px;
    padding: 4px 4px 8px 8px;
    position: relative;
}

.column-header h2 {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    margin: 0;
    overflow-wrap: anywhere;
}

.column-actions {
    align-items: center;
    display: flex;
    gap: 2px;
}

.list-menu {
    position: relative;
}

.list-menu-button {
    align-items: center;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    font-size: 18px;
    height: 28px;
    justify-content: center;
    letter-spacing: 1px;
    line-height: 1;
    list-style: none;
    width: 28px;
}

.list-menu-button:hover,
.list-menu[open] .list-menu-button {
    background: rgba(9, 30, 66, 0.08);
    color: var(--ink);
}

.list-menu-button::-webkit-details-marker {
    display: none;
}

.list-menu-panel {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(9, 30, 66, 0.24);
    color: var(--ink);
    display: grid;
    gap: 2px;
    min-width: 260px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: 34px;
    z-index: 30;
}

.list-menu-panel header {
    align-items: center;
    border-bottom: 1px solid #dfe1e6;
    display: flex;
    justify-content: center;
    margin: 0 0 6px;
    min-height: 34px;
}

.list-menu-panel hr {
    border: 0;
    border-top: 1px solid #dfe1e6;
    margin: 6px 0;
}

.menu-form {
    display: grid;
    gap: 6px;
    padding: 6px;
}

.menu-action {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    display: block;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.menu-action:hover {
    background: #f1f2f4;
}

.menu-action.danger {
    color: var(--danger);
}

.card-count {
    color: var(--muted);
    min-width: 24px;
    padding: 2px 6px;
    text-align: center;
}

.cards {
    display: grid;
    gap: 8px;
    min-height: 12px;
    overflow-y: auto;
    padding: 0 2px 2px;
}

.dropzone.is-over {
    background: rgba(9, 30, 66, 0.06);
    border-radius: 8px;
}

.card {
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(9, 30, 66, 0.25);
    color: var(--ink);
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    position: relative;
}

.card:hover {
    cursor: grab;
    outline: 2px solid rgba(12, 102, 228, 0.16);
}

.card.is-dragging {
    opacity: 0.35;
    cursor: grabbing;
}

.card-badges {
    align-items: center;
    color: var(--muted);
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.card-badge {
    align-items: center;
    display: inline-flex;
    gap: 3px;
}

.card-title-row {
    align-items: start;
    display: flex;
    gap: 8px;
}

.card h3 {
    flex: 1;
    font-size: 14px;
    line-height: 1.35;
    margin: 0;
    overflow-wrap: anywhere;
}

.card p {
    color: #44546f;
    line-height: 1.42;
    margin: 0;
}

.card.is-complete h3 {
    color: #626f86;
}

.complete-form {
    flex: 0 0 auto;
}

.complete-toggle {
    align-items: center;
    background: transparent;
    border: 2px solid #44546f;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    height: 20px;
    justify-content: center;
    line-height: 1;
    margin-top: 1px;
    width: 20px;
}

.complete-toggle:hover {
    background: rgba(9, 30, 66, 0.08);
    border-color: var(--primary);
}

.card.is-complete .complete-toggle {
    background: #6a9a23;
    border-color: #6a9a23;
    color: #ffffff;
}

.card.is-complete .complete-toggle:hover {
    background: #5b8a1f;
    border-color: #5b8a1f;
}

.card-menu {
    margin-left: auto;
}

.card-archive-button {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(9, 30, 66, 0.26);
    color: #172b4d;
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    height: 28px;
    justify-content: center;
    opacity: 0;
    position: absolute;
    right: 6px;
    top: 6px;
    transform: translateY(-2px);
    transition: opacity 0.12s ease, transform 0.12s ease, background 0.12s ease;
    width: 28px;
}

.card-archive-button img {
    display: block;
    height: 15px;
    opacity: 0.78;
    width: 15px;
}

.card:hover .card-archive-button,
.card-archive-button:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

.card-archive-button:hover {
    background: #f1f2f4;
}

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

.card-modal {
    inset: 0;
    position: fixed;
    z-index: 100;
}

.card-modal-backdrop {
    background: rgba(9, 14, 19, 0.72);
    inset: 0;
    position: absolute;
}

.card-modal-panel {
    background: #f1f2f4;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(9, 30, 66, 0.38);
    color: var(--ink);
    display: grid;
    grid-template-rows: 120px minmax(0, 1fr);
    left: 50%;
    max-height: calc(100vh - 48px);
    max-width: 1120px;
    overflow: hidden;
    position: absolute;
    top: 24px;
    transform: translateX(-50%);
    width: min(calc(100vw - 48px), 1120px);
}

.card-modal-cover {
    align-items: start;
    background: #f87171;
    color: #172b4d;
    display: flex;
    justify-content: space-between;
    padding: 18px 22px;
}

.card-modal-cover span {
    background: rgba(255, 255, 255, 0.78);
    border-radius: 4px;
    font-weight: 800;
    padding: 6px 10px;
}

.card-modal-close {
    align-items: center;
    background: rgba(255, 255, 255, 0.18);
    border: 0;
    border-radius: 999px;
    color: #172b4d;
    cursor: pointer;
    display: inline-flex;
    font-size: 28px;
    height: 40px;
    justify-content: center;
    line-height: 1;
    width: 40px;
}

.card-modal-close:hover {
    background: rgba(255, 255, 255, 0.42);
}

.card-modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    min-height: 0;
    overflow: hidden;
}

.card-modal-main,
.card-modal-comments {
    overflow-y: auto;
    padding: 28px;
}

.card-modal-comments {
    background: #ffffff;
    border-left: 1px solid #dfe1e6;
}

.modal-title-row {
    align-items: start;
    display: flex;
    gap: 14px;
}

.modal-title-row h2 {
    font-size: 28px;
    line-height: 1.2;
    margin: 0;
}

.modal-subtitle {
    color: var(--muted);
    margin: 8px 0 24px 36px;
}

.modal-edit-form {
    display: grid;
    gap: 14px;
    max-width: 680px;
}

.modal-edit-form label {
    color: var(--ink);
    display: grid;
    font-weight: 800;
    gap: 8px;
}

.color-swatches {
    display: flex;
    gap: 8px;
    margin-top: -6px;
}

.color-swatches span {
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.12);
    height: 24px;
    width: 42px;
}

.card-modal-comments h3 {
    margin: 0 0 16px;
}

.comment-form {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.comment-list {
    display: grid;
    gap: 16px;
}

.comment-item {
    align-items: start;
    display: grid;
    gap: 10px;
    grid-template-columns: auto 1fr;
}

.comment-item.is-reply {
    margin-left: 44px;
}

.avatar.small {
    height: 34px;
    width: 34px;
}

.comment-meta {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-meta span {
    color: var(--primary);
    font-size: 0.9rem;
}

.comment-item p {
    background: #ffffff;
    border: 1px solid #dfe1e6;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(9, 30, 66, 0.12);
    line-height: 1.5;
    margin: 0;
    padding: 10px 12px;
}

.comment-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.comment-actions form {
    display: inline;
}

.comment-actions button {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
    padding: 2px 0;
}

.comment-actions button:hover {
    color: var(--primary);
    text-decoration: underline;
}

.reply-form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.reply-form[hidden] {
    display: none;
}

.due {
    color: #44546f;
    font-size: 12px;
    font-weight: 700;
}

.icon-button {
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    height: 26px;
    line-height: 1;
    width: 26px;
}

.icon-button:hover {
    background: rgba(9, 30, 66, 0.08);
}

.icon-button.danger {
    color: var(--danger);
}

.edit-card summary,
.new-card-panel summary {
    border-radius: 6px;
    color: #44546f;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    padding: 8px;
}

.edit-card summary {
    color: var(--primary);
    padding: 0;
}

.new-card-panel summary:hover {
    background: rgba(9, 30, 66, 0.08);
    color: var(--ink);
}

.edit-card summary::-webkit-details-marker,
.new-card-panel summary::-webkit-details-marker {
    display: none;
}

.edit-card form,
.new-card {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.new-card-panel {
    margin-top: 8px;
}

.app-shell {
    background: #f4f6fb;
    min-height: calc(100vh - 48px);
    padding: 24px;
}

.narrow-shell {
    margin: 0 auto;
    max-width: 980px;
}

.topbar {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: 0 auto 24px;
    max-width: 980px;
}

.topbar h1 {
    margin: 0;
}

.manager-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(260px, 360px) 1fr;
}

.manager-panel {
    background: #ffffff;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    padding: 18px;
}

.manager-panel h2 {
    font-size: 1.05rem;
    margin: 0 0 14px;
}

.stack-form,
.board-list {
    display: grid;
    gap: 10px;
}

.board-row {
    align-items: center;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto auto;
    padding: 10px;
}

.shared-label {
    color: var(--muted);
    font-weight: 700;
}

.rename-board-form {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
}

.share-layout {
    grid-template-columns: minmax(280px, 380px) 1fr;
}

.panel-note {
    color: var(--muted);
    line-height: 1.45;
    margin: 12px 0 0;
}

.member-count {
    background: #dfe4ec;
    border-radius: 4px;
    color: var(--muted);
    display: inline-block;
    font-size: 0.85rem;
    margin-left: 4px;
    padding: 1px 8px;
}

.member-list {
    display: grid;
    gap: 10px;
}

.member-row {
    align-items: center;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: auto 1fr auto;
    padding: 10px;
}

.archive-grid {
    grid-template-columns: 1fr 1fr;
}

.archive-wide {
    grid-column: 1 / -1;
}

.archive-list {
    display: grid;
    gap: 10px;
}

.archive-row {
    align-items: center;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
    padding: 10px;
}

.archive-row p {
    color: var(--muted);
    margin: 4px 0 0;
}

.audit-shell {
    max-width: 1240px;
    margin: 0 auto;
}

.audit-topbar {
    max-width: none;
}

.audit-filter select {
    min-width: 190px;
}

.audit-panel {
    overflow-x: auto;
}

.audit-table {
    display: grid;
    min-width: 900px;
}

.audit-row {
    align-items: start;
    border-bottom: 1px solid #dfe4ec;
    display: grid;
    gap: 12px;
    grid-template-columns: 150px 210px 160px minmax(260px, 1fr) 110px;
    padding: 12px 0;
}

.audit-head {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.audit-row small {
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.audit-row code {
    background: #eef2f8;
    border-radius: 4px;
    color: var(--ink);
    font-family: inherit;
    padding: 2px 6px;
}

.entity-link {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.entity-link:hover {
    text-decoration: underline;
}

.member-row p {
    color: var(--muted);
    margin: 4px 0 0;
}

.avatar {
    align-items: center;
    background: var(--primary);
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

@media (max-width: 720px) {
    .nav-search {
        display: none;
    }

    .global-nav {
        gap: 8px;
    }

    .brand span:last-child {
        display: none;
    }

    .board-bar {
        align-items: stretch;
        flex-direction: column;
        height: auto;
    }

    .trello-shell {
        grid-template-rows: auto 1fr;
    }

    .card-modal-panel {
        border-radius: 0;
        inset: 0;
        max-height: none;
        top: 0;
        transform: none;
        width: 100vw;
    }

    .card-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .card-modal-main,
    .card-modal-comments {
        overflow: visible;
    }

    .topbar-actions,
    .manager-grid,
    .share-layout,
    .board-row,
    .member-row,
    .archive-grid,
    .archive-row,
    .rename-board-form {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }
}
