:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --text: #121a2b;
    --muted: #4f5b70;
    --line: #d9dee8;
    --primary: #24436e;
    --shadow: none;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100%;
}

html.no-scroll,
body.no-scroll {
    overflow: hidden;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
    color: var(--muted);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px clamp(16px, 4vw, 36px);
    backdrop-filter: blur(10px);
    background: var(--bg);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.topbar h1 {
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.layout {
    padding: 22px clamp(16px, 4vw, 36px) 40px;
}

.tabs {
    display: inline-flex;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.25);
    padding: 4px;
    gap: 4px;
    margin-bottom: 18px;
}

.tab-btn {
    border: 0;
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: var(--muted);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.tab-btn.active {
    background: var(--surface-strong);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.tab-panel {
    display: none;
    animation: fadeIn 220ms ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filters label,
.form-inline label,
.stack label {
    display: grid;
    gap: 4px;
    font-size: 0.88rem;
    color: var(--muted);
}

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

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #8ea2c2;
    box-shadow: 0 0 0 3px rgba(36, 67, 110, 0.14);
}

button {
    cursor: pointer;
}

.btn {
    border-radius: 10px;
    border: 0;
    padding: 10px 14px;
    font-weight: 700;
    transition: transform 120ms ease, opacity 120ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-soft {
    background: rgba(36, 67, 110, 0.1);
    color: var(--primary);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
}

.btn-success {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
}

.user-chip span {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.user-chip a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.presence {
    font-size: 0.85rem;
    color: #1a2b45;
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(36, 67, 110, 0.12);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    color: #10253f;
    font-size: 0.83rem;
    font-weight: 600;
}

.legend-item::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.legend-draft {
    background: rgba(95, 107, 122, 0.18);
}

.legend-draft::before {
    background: #5f6b7a;
}

.legend-pending {
    background: rgba(217, 119, 6, 0.18);
}

.legend-pending::before {
    background: #d97706;
}

.legend-approved {
    background: rgba(22, 163, 74, 0.16);
}

.legend-approved::before {
    background: #15803d;
}

.legend-rejected {
    background: rgba(220, 38, 38, 0.16);
}

.legend-rejected::before {
    background: #b91c1c;
}

.legend-official {
    background: rgba(36, 67, 110, 0.2);
}

.legend-official::before {
    background: #24436e;
}

.legend-quirky {
    background: rgba(125, 85, 199, 0.16);
}

.legend-quirky::before {
    background: #7c3aed;
}

#calendar {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.fc .fc-toolbar-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
}

.fc .fc-button-primary {
    background: #24436e;
    border-color: #24436e;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus {
    background: #1c3457;
    border-color: #1c3457;
}

.fc .fc-daygrid-day-number {
    color: #0f172a;
}

.card,
.table-wrap {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.form-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
    padding: 14px;
    margin-bottom: 14px;
}

.table-wrap {
    overflow: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.table td input,
.table td select {
    min-width: 120px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
}

.approvals-board {
    display: grid;
    gap: 16px;
}

.approval-section {
    display: grid;
    gap: 10px;
}

.approval-section h3 {
    font-size: 1rem;
}

.approval-empty {
    padding: 12px;
}

.approvals-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ideas-tools {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}

.ideas-filter {
    display: grid;
    gap: 4px;
    font-size: 0.88rem;
    color: var(--muted);
}

.ideas-filter select {
    min-width: 230px;
}

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

.week-board {
    display: grid;
    gap: 12px;
}

.week-alerts {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.week-alert-item {
    border: 1px solid rgba(36, 67, 110, 0.24);
}

.week-day {
    background: var(--surface);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.week-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.week-day-head h3 {
    font-size: 1rem;
}

.week-items {
    display: grid;
    gap: 10px;
}

.week-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    gap: 8px;
    background: #fff;
}

.week-item h4 {
    font-size: 0.98rem;
    margin: 0;
}

.week-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.week-inline-alert {
    font-size: 0.84rem;
}

.week-empty {
    padding: 14px;
}

.week-empty-day {
    padding: 8px 0;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(36, 67, 110, 0.12);
    color: var(--primary);
    font-size: 0.86rem;
    font-weight: 700;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 999px;
    background: #d97706;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
}

.approval-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge.pending_approval {
    background: rgba(217, 119, 6, 0.14);
    color: #92400e;
}

.badge.approved {
    background: rgba(22, 163, 74, 0.14);
    color: #166534;
}

.badge.rejected {
    background: rgba(220, 38, 38, 0.14);
    color: #991b1b;
}

.badge.draft {
    background: rgba(100, 116, 139, 0.16);
    color: #334155;
}

.badge.idea-new {
    background: rgba(36, 67, 110, 0.14);
    color: #1d3a5d;
}

.badge.idea-in_review {
    background: rgba(217, 119, 6, 0.14);
    color: #92400e;
}

.badge.idea-planned {
    background: rgba(22, 163, 74, 0.14);
    color: #166534;
}

.badge.idea-archived {
    background: rgba(100, 116, 139, 0.16);
    color: #334155;
}

.meta {
    color: var(--muted);
    font-size: 0.88rem;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
}

.hidden {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(3px);
}

.modal-panel {
    position: relative;
    width: min(920px, 95vw);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    display: grid;
    gap: 14px;
}

.modal-panel-small {
    width: min(560px, 94vw);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: 0;
    background: #e6ebf4;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    line-height: 1;
}

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

.settings-card {
    margin-top: 14px;
    padding: 14px;
}

.helper-text {
    font-size: 0.82rem;
    color: var(--muted);
}

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

.platform-fieldset {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0;
    min-width: 0;
}

.platform-fieldset legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 0.88rem;
}

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

.check-pill {
    display: grid;
    grid-template-columns: 14px 1fr;
    align-items: start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.2;
}

.check-pill input {
    margin: 2px 0 0;
    align-self: start;
}

.check-pill span {
    display: block;
}

.status-info {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.14);
    color: #166534;
    font-size: 0.84rem;
    font-weight: 700;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    font-size: 0.87rem;
    color: var(--muted);
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.comment-list {
    display: grid;
    gap: 8px;
    max-height: 200px;
    overflow: auto;
    margin-bottom: 10px;
}

.comment {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
}

.comment-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
}

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

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(36, 67, 110, 0.12);
    color: var(--primary);
}

.alert-warning {
    background: rgba(36, 67, 110, 0.12);
    color: var(--primary);
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    min-width: 220px;
    max-width: 380px;
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 200ms ease;
    z-index: 120;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

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

.login-backdrop {
    display: none;
}

.login-shell {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
    align-items: stretch;
}

.login-story {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: clamp(22px, 4vw, 34px);
    display: grid;
    align-content: center;
    gap: 12px;
}

.login-story h1 {
    font-size: clamp(1.7rem, 3.2vw, 2.35rem);
    line-height: 1.08;
}

.login-story ul {
    margin: 8px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.login-story li::marker {
    color: var(--primary);
}

.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.23);
    padding: clamp(22px, 3.6vw, 30px);
    display: grid;
    gap: 14px;
}

.login-card h2 {
    font-size: 1.5rem;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form input {
    width: 100%;
}

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

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

    .comment-form {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-right {
        justify-content: flex-start;
    }

    .login-shell {
        grid-template-columns: 1fr;
        width: min(560px, 100%);
    }

    .login-story {
        padding: 20px;
    }
}

@media (max-width: 720px) {
    .layout {
        padding: 14px;
    }

    .tabs {
        width: 100%;
        overflow: auto;
    }

    .tab-btn {
        flex: 1 0 auto;
    }

    .panel-header {
        align-items: stretch;
    }

    .approvals-tools {
        justify-content: space-between;
    }

    .ideas-tools {
        width: 100%;
    }

    .ideas-filter {
        width: 100%;
    }

    .ideas-filter select {
        min-width: 0;
        width: 100%;
    }

    .weeklist-tools {
        width: 100%;
    }

    .weeklist-tools .summary-chip {
        width: 100%;
        justify-content: center;
    }

    .weeklist-tools .btn {
        flex: 1 0 auto;
    }

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

    #calendar {
        padding: 6px;
    }
}
