:root {
    --page-bg: #f5f5f7;
    --surface: #ffffff;
    --surface-muted: #fbfbfd;
    --border: #d2d2d7;
    --border-strong: #b8b8bd;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --text-soft: #86868b;
    --blue: #0071e3;
    --blue-hover: #005bb5;
    --green: #1f7a3d;
    --orange: #b35c00;
    --red: #b42318;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background: var(--page-bg);
}

.heading-style-h2,
.heading-style-h3,
.heading-style-h4,
.heading-style-h5,
.heading-style-h6 {
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

.heading-style-h2 {
    font-size: clamp(28px, 3vw, 36px);
    line-height: 1.12;
}

.heading-style-h3 {
    font-size: clamp(24px, 3vw, 30px);
    line-height: 1.15;
}

.heading-style-h4 {
    font-size: clamp(20px, 2.4vw, 24px);
    line-height: 1.2;
}

.heading-style-h5 {
    font-size: 16px;
    line-height: 1.25;
}

.heading-style-h6 {
    font-size: 14px;
    line-height: 1.3;
}

.text-style-body {
    font-size: 13px;
    line-height: 1.45;
}

.btn {
    min-height: 34px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    box-shadow: none;
}

.btn-compact {
    min-height: 32px;
    padding: 6px 11px;
}

.btn-thread-mini {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 11px;
}

.btn-cta-primary {
    color: #fff;
    background: var(--blue);
    border: 1px solid var(--blue);
}

.btn-cta-primary:hover,
.btn-cta-primary:focus {
    color: #fff;
    background: var(--blue-hover);
    border-color: var(--blue-hover);
}

.btn-cta-green {
    color: #fff;
    background: var(--text);
    border: 1px solid var(--text);
}

.btn-cta-status {
    color: #fff;
    background: #2f6fed;
    border: 1px solid #2f6fed;
}

.btn-cta-status:hover,
.btn-cta-status:focus {
    color: #fff;
    background: #1f5fd8;
    border-color: #1f5fd8;
}

.btn-cta-edit {
    color: #1d1d1f;
    background: #f2f2f4;
    border: 1px solid #d2d2d7;
}

.btn-cta-edit:hover,
.btn-cta-edit:focus {
    color: #1d1d1f;
    background: #e8e8ed;
    border-color: #c7c7cc;
}

.btn-cta-dark-outline {
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border-strong);
}

.btn-dropdown-toggle::after {
    content: "▾";
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    line-height: 1;
    vertical-align: middle;
}

.ls-form-control,
.ls-form-select,
.ls-form-textarea {
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    background: #fff;
    color: var(--text);
}

.ls-form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 34px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.ls-form-control:focus,
.ls-form-select:focus,
.ls-form-textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.ls-form-textarea {
    min-height: 96px;
}

.small-label {
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-soft);
    letter-spacing: 0;
    text-transform: none;
}

.auth-shell,
.board-shell {
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card,
.board-panel,
.stat-card,
.sub-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 460px);
    padding: 24px;
}

.auth-kicker,
.board-kicker {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.auth-title {
    margin-top: 8px;
}

.auth-copy,
.auth-hint {
    margin-top: 8px;
    color: var(--text-muted);
}

.auth-form,
.stack-form {
    display: grid;
    gap: 12px;
}

.board-container {
    max-width: 1520px;
}

.board-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

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

.board-subtitle {
    max-width: 760px;
    margin-top: 6px;
    color: var(--text-muted);
}

.modal-copy {
    color: var(--text-muted);
    font-size: 12px;
}

.modal-content {
    height: 75vh;
}

.modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.report-textarea {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: none;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    white-space: pre-wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.stat-card {
    padding: 14px;
}

.stat-card--status {
    transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.stat-card--status.is-unselected {
    opacity: 0.55;
    background: var(--surface-muted);
}

.stat-toggle {
    display: inline-flex;
    width: 100%;
    gap: 10px;
    align-items: center;
    min-height: 100%;
    cursor: pointer;
    flex-wrap: nowrap;
}

.stat-toggle-input {
    flex: 0 0 auto;
    margin-top: 0;
    align-self: center;
}

.stat-toggle-copy {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    flex-wrap: nowrap;
}

.stat-card--hot {
    background: var(--surface);
}

.stat-card--feedback-pending {
    background: #fdecec;
    border-color: #f0b6b6;
}

.stat-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-soft);
}

.stat-value {
    display: block;
    margin-top: 8px;
    font-size: 24px;
    line-height: 1;
    font-weight: 600;
    color: var(--text);
}

.stat-card--status .stat-label,
.stat-card--status .stat-value {
    margin-top: 0;
}

.stat-card--status .stat-label {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card--status .stat-value {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}

.progress-card {
    margin-top: 12px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.progress-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 12px;
}

.progress-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-soft);
}

.progress-value {
    display: block;
    margin-top: 6px;
    font-size: 22px;
    line-height: 1;
    font-weight: 600;
    color: var(--text);
}

.progress-meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.project-progress {
    position: relative;
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: #e8edf3;
}

.project-progress-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #407e43 0%, #6cb55f 100%);
    transition: width 0.25s ease;
}

.progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.progress-legend span {
    white-space: nowrap;
}

.progress-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-soft);
}

.progress-breakdown span {
    white-space: nowrap;
}

.board-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

.board-panel {
    padding: 18px;
}

.sub-panel {
    padding: 14px;
    background: var(--surface-muted);
}

.panel-head {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.panel-head--inline {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: end;
    column-gap: 18px;
    row-gap: 10px;
}

.panel-actions {
    display: flex;
    align-items: end;
    gap: 10px;
}

.panel-title-block {
    min-width: 0;
}

.panel-actions--center {
    justify-content: center;
}

.panel-actions--right {
    justify-content: flex-end;
}

.sort-form {
    display: grid;
    gap: 4px;
}

.sort-filter-row {
    display: flex;
    gap: 10px;
    align-items: end;
}

.sort-filter-group {
    display: grid;
    gap: 4px;
}

.sort-select {
    min-width: 170px;
}

.compact-form {
    gap: 10px;
}

.compact-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.add-project-wrap {
    margin-bottom: 12px;
}

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

.thread-card {
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface);
}

.thread-card--hot {
    border-left: 3px solid var(--blue);
}

.thread-summary {
    display: flex;
    gap: 14px;
    align-items: stretch;
    padding-right: 14px;
}

.thread-button {
    background: transparent;
    padding: 14px 16px;
}

.thread-button:not(.collapsed) {
    color: inherit;
    background: var(--surface-muted);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: inset 0 0 0 1px var(--blue);
}

.thread-button::after {
    margin-left: 10px;
    width: 13px;
    height: 13px;
    background-size: 13px;
}

.thread-line {
    width: 100%;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.thread-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 500;
}

.thread-rank--pending {
    background: #fdecec;
    border-color: #f0b6b6;
    color: var(--red);
}

.thread-rank--done {
    background: #eaf6ed;
    border-color: #b7d8c0;
    color: var(--green);
}

.thread-main {
    display: grid;
    gap: 3px;
}

.thread-title {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.thread-updated {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 400;
}

.thread-links {
    display: grid;
    gap: 6px;
    min-width: 92px;
    padding: 12px 0;
    font-size: 11px;
}

.thread-links a {
    color: var(--blue);
    font-weight: 500;
    text-decoration: none;
}

.thread-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.badge {
    border-radius: 0 !important;
    font-size: 10px;
    padding: 5px 7px;
    font-weight: 500;
}

.text-bg-primary {
    background: #e8f1fb !important;
    color: #174ea6 !important;
}

.text-bg-warning {
    background: #fff3e6 !important;
    color: var(--orange) !important;
}

.text-bg-danger {
    background: #fdecec !important;
    color: var(--red) !important;
}

.text-bg-success {
    background: #eaf6ed !important;
    color: var(--green) !important;
}

.text-bg-info {
    background: #e7f0ff !important;
    color: #2457c5 !important;
}

.text-bg-secondary {
    background: #f0f0f2 !important;
    color: #55565a !important;
}

.thread-body {
    padding: 0 16px 16px;
}

.thread-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
    padding-top: 6px;
}

.thread-meta-copy {
    min-width: 0;
}

.thread-meta-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

.meta-label {
    display: block;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.status-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.thread-edit-form {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
}

.edit-toggle-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.feedback-stream {
    display: grid;
    gap: 10px;
}

.feedback-item {
    padding: 14px;
    border: 1px solid var(--border);
    background: #fff;
}

.feedback-item--pending {
    border-left: 3px solid var(--blue);
}

.feedback-item--resolved {
    border-left: 3px solid #b8c9b9;
}

.feedback-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.feedback-meta-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

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

.feedback-category-form {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feedback-category-select {
    min-width: 112px;
    font-size: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.feedback-head strong {
    font-size: 12px;
    font-weight: 600;
}

.feedback-head span {
    display: block;
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 11px;
}

.feedback-message {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text);
}

.feedback-image-link {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.feedback-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.feedback-image {
    max-width: min(100%, 240px);
    border: 1px solid var(--border);
}

.feedback-image--thumb {
    width: 92px;
    height: 92px;
    object-fit: cover;
    display: block;
}

.feedback-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.feedback-type-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 34px;
    align-items: center;
}

.feedback-type-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text);
}

.feedback-comments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.feedback-comment-list {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.feedback-comment {
    padding: 10px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.feedback-comment strong,
.feedback-comment span,
.feedback-comment p {
    font-size: 12px;
}

.feedback-comment span {
    display: block;
    margin-top: 2px;
    color: var(--text-soft);
}

.feedback-comment p {
    margin: 6px 0 0;
    color: var(--text);
    line-height: 1.45;
}

.feedback-comment-form {
    margin-top: 8px;
}

.feedback-lightbox-body {
    display: grid;
    gap: 14px;
}

.feedback-lightbox-image {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: #f5f5f7;
    border: 1px solid var(--border);
}

.feedback-lightbox-note {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
}

.feedback-empty,
.empty-state {
    padding: 12px;
    background: var(--surface-muted);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 12px;
}

.alert {
    border-radius: 0;
    font-size: 12px;
}

@media (max-width: 991.98px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .board-header,
    .thread-meta,
    .panel-head--inline {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .panel-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-actions--center,
    .panel-actions--right {
        justify-content: flex-start;
    }

    .sort-select {
        min-width: 0;
    }

    .thread-summary {
        flex-direction: column;
        padding-right: 0;
    }

    .thread-line {
        grid-template-columns: 1fr;
    }

    .thread-badges,
    .compact-actions {
        justify-content: flex-start;
    }

    .thread-links {
        padding: 0 14px 12px;
    }

    .status-form {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
}

@media (max-width: 575.98px) {
    .auth-card,
    .board-panel,
    .stat-card,
    .sub-panel {
        padding: 12px;
    }

    .thread-button,
    .thread-body {
        padding-left: 10px;
        padding-right: 10px;
    }

    .thread-edit-form {
        padding: 10px;
    }
}
