:root {
    --bg: #fbfbfc;
    --surface: #ffffff;
    --surface-soft: #f6f7fa;
    --text: #11131a;
    --muted: #6d7280;
    --line: #e4e7ed;
    --accent: #5867dd;
    --accent-dark: #2936a3;
    --danger: #b42318;
    --warn: #c06d20;
    --ok: #2d9368;
    --blue: #5367df;
    --orange: #f29a43;
    --green: #42a978;
    --violet: #6a5be8;
    --shadow: 0 20px 60px rgba(17, 19, 26, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-dark); }

p,
td,
th,
label,
.badge,
.button,
button {
    overflow-wrap: anywhere;
}

h1,
h2,
h3 {
    overflow-wrap: break-word;
}

svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.9;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto auto auto auto 1fr auto;
    gap: 18px;
    padding: 24px 22px 22px;
    background: rgba(255, 255, 255, .9);
    border-right: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 0;
}

.brand-icon {
    display: inline-flex;
    color: #11131a;
}

.brand img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
}

.button.new-proposal {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    min-height: 46px;
    padding: 0 16px;
    background: #111821;
    border-radius: 7px;
    box-shadow: 0 12px 28px rgba(17, 24, 33, .18);
}

.button.new-proposal:hover { background: #05070a; color: #fff; }

.side-nav {
    display: grid;
    gap: 5px;
}

.side-nav-secondary {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 11px;
    border-radius: 8px;
    color: #252936;
    font-size: 14px;
    font-weight: 600;
}

.side-nav a.active,
.side-nav a:hover {
    background: #f3f4f6;
    color: #11131a;
}

.side-nav svg {
    width: 19px;
    height: 19px;
    color: #303744;
}

.sidebar-user {
    align-self: end;
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.sidebar-user.guest > div {
    grid-column: 1 / 3;
}

.guest-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.guest-actions .button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
}

.sidebar-user strong,
.sidebar-user span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user strong {
    font-size: 13px;
}

.sidebar-user span {
    color: var(--muted);
    font-size: 12px;
}

.vote-meter {
    grid-column: 1 / -1;
    display: grid;
    gap: 6px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.vote-meter-head {
    display: grid;
    grid-template-columns: 18px auto 1fr;
    align-items: center;
    gap: 8px;
}

.vote-meter-head svg {
    width: 17px;
    height: 17px;
    color: var(--accent);
}

.vote-meter-head strong {
    font-size: 15px;
}

.vote-meter-head span:last-child {
    justify-self: end;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.vote-meter-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #dde1e8;
}

.vote-meter-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.user-menu {
    position: relative;
    grid-column: 1 / -1;
}

.user-menu summary {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    list-style: none;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu-copy {
    min-width: 0;
}

.user-menu-chevron {
    display: inline-flex;
    color: var(--muted);
    transition: transform .16s ease;
}

.user-menu[open] .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-popover {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 20;
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.user-menu-popover a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 7px;
    color: #252936;
    font-size: 13px;
    font-weight: 700;
}

.user-menu-popover a:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.user-menu-popover svg {
    width: 17px;
    height: 17px;
}

.main-area {
    min-width: 0;
    display: grid;
    grid-template-rows: 1fr auto;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #11131a;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.container {
    width: min(1400px, calc(100% - 88px));
    margin: 24px auto 40px;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(1400px, calc(100% - 88px));
    margin: 0 auto 24px;
    color: #8b90a0;
    font-size: 13px;
}

.site-footer svg {
    width: 18px;
    height: 18px;
}

.site-footer a {
    color: #707686;
    font-weight: 700;
}

.board-head {
    margin-bottom: 24px;
}

.board-head h1,
.page-title {
    margin: 0;
    color: #05060a;
    font-size: clamp(28px, 2.4vw, 36px);
    line-height: 1.08;
    letter-spacing: 0;
}

.board-head p,
.hero p,
.muted {
    color: var(--muted);
}

.board-head p {
    margin: 10px 0 20px;
    font-size: 14px;
}

.board-controls {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 230px 230px;
    gap: 14px;
}

.search-control {
    position: relative;
}

.search-control svg {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #424855;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: 500 14px/1.2 inherit;
    outline: none;
    box-shadow: 0 8px 24px rgba(17, 19, 26, .025);
}

input[type="file"] {
    min-height: auto;
    padding: 15px 18px;
}

.search-control input {
    padding-right: 58px;
}

textarea {
    min-height: 120px;
    padding-top: 12px;
    line-height: 1.5;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: color-mix(in srgb, var(--accent), white 28%);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 86%);
}

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(250px, 1fr));
    gap: 16px;
    align-items: start;
}

.board-grid[data-admin="1"] {
    grid-template-columns: repeat(5, minmax(210px, 1fr));
}

.column {
    min-height: 560px;
    display: flex;
    flex-direction: column;
    padding: 16px 12px 16px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 42px rgba(17, 19, 26, .025);
}

.column-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 0 6px 14px;
    margin-bottom: 12px;
    border-bottom: 2px solid color-mix(in srgb, currentColor, transparent 72%);
}

.column-head > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.column h2 {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    letter-spacing: 0;
}

.column-icon {
    display: inline-flex;
}

.count-pill {
    min-width: 28px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor, white 88%);
    font-size: 13px;
    font-weight: 800;
}

.column.gray { color: #626a78; }
.column.blue { color: var(--blue); }
.column.orange { color: var(--orange); }
.column.green { color: var(--green); }
.column.violet { color: var(--violet); }

.column .idea-card,
.column .empty-column {
    color: var(--text);
}

.card {
    display: grid;
    gap: 10px;
    padding: 15px 13px 13px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(17, 19, 26, .035);
}

.card[hidden] {
    display: none;
}

.idea-card.voted-positive {
    border-color: #8a8f14;
    background: #f5f7d8;
}

.idea-card.voted-negative {
    border-color: #7a1111;
    background: #f2dddd;
}

[data-board][data-admin="1"] .idea-card {
    cursor: grab;
}

[data-board][data-admin="1"] .idea-card:active {
    cursor: grabbing;
}

.idea-card.dragging {
    opacity: .62;
    transform: rotate(.4deg);
}

.column.drop-target {
    outline: 2px solid color-mix(in srgb, var(--accent), transparent 35%);
    outline-offset: 4px;
    background: color-mix(in srgb, var(--accent), white 94%);
}

.card h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.25;
    letter-spacing: 0;
}

.card h3 a:hover {
    color: currentColor;
    text-decoration: underline;
}

.idea-number {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.card p {
    min-height: 38px;
    margin: 0;
    color: #4e5565;
    font-size: 13px;
}

.card-foot {
    display: flex;
    align-items: center;
    gap: 14px;
}

.metric {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #1f2633;
    font-size: 13px;
    font-weight: 700;
}

.metric svg {
    width: 15px;
    height: 15px;
}

.author-chip {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    border-radius: 50%;
    background: #f0f2f6;
    color: #596070;
    font-size: 12px;
    font-weight: 800;
}

.card-vote-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.icon-vote {
    min-height: 34px;
    gap: 8px;
    padding: 0 9px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
}

.icon-vote:hover {
    color: #fff;
}

.icon-vote.up:hover {
    background: var(--ok);
}

.icon-vote.down:hover {
    background: var(--danger);
}

.icon-vote:disabled:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.icon-vote svg {
    width: 18px;
    height: 18px;
}

.icon-vote strong {
    min-width: 1.2em;
    font-size: 13px;
    line-height: 1;
}

.vote-availability {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.vote-availability strong {
    color: var(--text);
    font-size: 13px;
}

.revoke-hint {
    margin-top: -4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.revoke-hint.locked {
    color: var(--muted);
}

.vote-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 14px 0;
}

.vote-detail-grid > div {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.vote-detail-grid span,
.vote-detail-grid strong {
    display: block;
}

.vote-detail-grid span {
    color: var(--muted);
    font-size: 12px;
}

.vote-detail-grid strong {
    margin-top: 4px;
    font-size: 20px;
}

.revoke-actions {
    margin-top: 10px;
}

.column-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: auto 8px 0;
    padding-top: 12px;
    color: currentColor;
    font-size: 13px;
    font-weight: 700;
}

.column-link svg {
    width: 16px;
    height: 16px;
}

.empty-column {
    padding: 14px 8px;
    color: var(--muted);
    font-size: 14px;
}

.hero {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.grid {
    display: grid;
    gap: 12px;
}

.meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    color: var(--muted);
    font-size: 13px;
}

.score {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--text);
}

.panel {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form {
    display: grid;
    gap: 12px;
    max-width: 720px;
    width: 100%;
}

.form.compact { max-width: 460px; }

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font: 800 13px/1 system-ui, sans-serif;
    cursor: pointer;
    text-align: center;
}

.button:hover,
button:hover {
    background: var(--accent-dark);
    color: #fff;
    text-decoration: none;
}

button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

button:disabled:hover {
    background: var(--accent);
}

button.secondary:disabled:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.button.secondary,
button.secondary {
    background: var(--surface-soft);
    color: var(--text);
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.small {
    min-height: 30px;
    padding: 0 10px;
}

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

.merge-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.flash {
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.flash.error { border-color: #f3b4ad; color: var(--danger); }
.flash.success { border-color: #9bd3b4; color: var(--ok); }
.flash.info { border-color: #f0d18a; color: var(--warn); }

.idea-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 16px;
    align-items: start;
}

.comments {
    display: grid;
    gap: 9px;
}

.comment {
    padding: 11px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.admin-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: var(--surface-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 21px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.content-section {
    margin-top: 24px;
    padding: 18px;
    background: rgba(255, 255, 255, .78);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 42px rgba(17, 19, 26, .025);
}

.section-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f0f2f6;
    color: var(--accent);
    flex: 0 0 auto;
}

.section-head h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0;
}

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

.activity-list {
    display: grid;
    gap: 8px;
}

.activity-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.activity-item strong,
.activity-item span {
    display: block;
}

.activity-item strong {
    font-size: 14px;
}

.activity-item div > span {
    color: var(--muted);
    font-size: 13px;
}

.activity-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f6f7fa;
    color: var(--accent);
}

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

.stat-card {
    padding: 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-card > span {
    display: inline-flex;
    color: var(--accent);
    margin-bottom: 18px;
}

.stat-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
}

.stat-card p {
    margin: 8px 0 0;
    color: var(--muted);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.faq-grid details {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.faq-grid summary {
    cursor: pointer;
    font-weight: 800;
}

.faq-grid p {
    margin: 12px 0 0;
    color: var(--muted);
}

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
    .sidebar { padding: 22px 18px; }
    .brand { font-size: 20px; }
    .side-nav a { gap: 12px; padding-inline: 10px; }
    .container,
    .site-footer {
        width: min(1400px, calc(100% - 48px));
    }
    .board-grid,
    .board-grid[data-admin="1"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .board-controls { grid-template-columns: 1fr 1fr; }
    .search-control { grid-column: 1 / -1; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    .app-shell { display: block; }
    .sidebar {
        position: static;
        height: auto;
        display: grid;
        gap: 12px;
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .brand {
        font-size: 19px;
        min-width: 0;
    }
    .brand > span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .button.new-proposal {
        min-height: 42px;
        justify-content: center;
    }
    .side-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .side-nav-secondary {
        padding-top: 0;
        border-top: 0;
    }
    .side-nav a {
        flex: 1 1 150px;
        min-height: 38px;
        padding: 0 10px;
        gap: 9px;
        border: 1px solid var(--line);
        background: #fff;
        font-size: 13px;
    }
    .side-nav svg {
        width: 17px;
        height: 17px;
    }
    .sidebar-user {
        display: grid;
        padding-top: 10px;
        border-top: 1px solid var(--line);
    }
    .user-menu-popover {
        top: calc(100% + 8px);
        bottom: auto;
    }
    .container,
    .site-footer {
        width: min(100% - 28px, 1400px);
    }
    .container {
        margin: 18px auto 28px;
    }
    .board-head {
        margin-bottom: 18px;
    }
    .board-head h1,
    .page-title {
        font-size: 28px;
    }
    .board-grid,
    .board-controls,
    .idea-layout,
    .stats-grid,
    .faq-grid {
        grid-template-columns: 1fr;
    }
    .board-controls {
        gap: 12px;
    }
    .content-section { padding: 14px; }
    .section-head {
        gap: 12px;
    }
    .activity-item { grid-template-columns: 38px minmax(0, 1fr); }
    .activity-item .badge { grid-column: 2; justify-self: start; }
    .column { min-height: auto; }
    .panel { padding: 14px; }
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .site-footer {
        flex-wrap: wrap;
        text-align: center;
    }
}

@media (max-width: 520px) {
    .sidebar {
        padding: 14px;
    }
    .container,
    .site-footer {
        width: calc(100% - 20px);
    }
    .board-head h1,
    .page-title {
        font-size: 25px;
    }
    .panel,
    .content-section,
    .column,
    .card,
    .stat-card {
        padding: 11px;
    }
    input,
    textarea,
    select {
        min-height: 42px;
        padding-inline: 14px;
    }
    .search-control input {
        padding-right: 46px;
    }
    .search-control svg {
        right: 14px;
    }
    .actions {
        align-items: stretch;
    }
    .actions > .button,
    .actions > button,
    .actions > select {
        flex: 1 1 100%;
    }
    .vote-availability,
    .card-foot {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .author-chip {
        margin-left: 0;
    }
    .section-head {
        display: grid;
    }
    .activity-item {
        grid-template-columns: 1fr;
    }
    .activity-item .badge {
        grid-column: auto;
    }
    .activity-icon {
        width: 34px;
        height: 34px;
    }
    .admin-tabs .button {
        flex: 1 1 auto;
    }
    .side-nav a {
        flex-basis: 100%;
    }
}
