:root {
    --gaa-green: #00876e;
    --gaa-apple: #9fcc42;
    --gaa-gray: #54595f;
    --gaa-white: #ffffff;
    --bg: #f5f8f7;
    --border: #d8e3df;
    --text: #243236;
    --amber: #d99100;
    --red: #bf2c24;
}

@font-face {
    font-family: "Brandon Grotesque Web";
    src: local("Brandon Grotesque Regular"),
         url("/static/fonts/BrandonGrotesque-Regular.woff2") format("woff2"),
         url("/static/fonts/BrandonGrotesque-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Brandon Grotesque Web";
    src: local("Brandon Grotesque Medium"),
         url("/static/fonts/BrandonGrotesque-Medium.woff2") format("woff2"),
         url("/static/fonts/BrandonGrotesque-Medium.woff") format("woff");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Brandon Grotesque Web";
    src: local("Brandon Grotesque Bold"),
         url("/static/fonts/BrandonGrotesque-Bold.woff2") format("woff2"),
         url("/static/fonts/BrandonGrotesque-Bold.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Brandon Grotesque Web", "Brandon Grotesque", "Avenir Next", "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #f8fbfa 0%, #eef6f3 100%);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

body.is-waiting,
body.is-waiting * {
    cursor: wait !important;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: linear-gradient(170deg, var(--gaa-green), #006652);
    padding: 1.5rem;
    color: var(--gaa-white);
    display: flex;
    flex-direction: column;
}

.logo-wrap {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 0.75rem;
}

.logo {
    width: 100%;
    display: block;
}

.menu {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.menu-item {
    text-decoration: none;
    color: #eaf6f2;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.auth-panel {
    margin-top: auto;
    padding-top: 1rem;
}

.auth-user {
    margin: 0 0 0.55rem;
    font-size: 0.85rem;
    color: #ddf3eb;
}

.auth-logout {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #f3fbf8;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.auth-logout:hover {
    background: rgba(255, 255, 255, 0.1);
}

.content {
    padding: 2rem;
}

.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: grid;
    gap: 0.55rem;
    width: min(420px, calc(100vw - 2rem));
}

.toast {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    border: 1px solid #a8d7c7;
    background: #e8f6ef;
    color: #105a47;
    box-shadow: 0 10px 24px rgba(16, 48, 40, 0.14);
}

.toast--success {
    border-color: #a8d7c7;
    background: #e8f6ef;
    color: #105a47;
}

.toast--info {
    border-color: #b7d7ec;
    background: #eaf5fb;
    color: #0d4467;
}

.toast--warning {
    border-color: #f0d39a;
    background: #fff7e8;
    color: #7a4d00;
}

.toast--error {
    border-color: #f4b8b2;
    background: #fdecea;
    color: #8f1d1d;
}

.toast__body {
    line-height: 1.35;
}

.toast__close {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.toast__close:hover {
    opacity: 1;
}

.page-header h1 {
    margin: 0;
    color: var(--gaa-green);
}

.page-header p {
    margin: 0.5rem 0 0;
    color: var(--gaa-gray);
}

.page-header .primary-button {
    margin-top: 1rem;
}

.filter-panel {
    margin-top: 1.1rem;
}

.filter-panel__toggle {
    border: 0;
    background: transparent;
    color: var(--gaa-green);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 0.22rem;
}

.filter-panel__options {
    margin-top: 0.75rem;
    background: var(--gaa-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}

.filter-panel__actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 0.85rem;
}

.filter-panel__count {
    color: #587169;
    font-size: 0.92rem;
    font-weight: 600;
}

.card {
    background: var(--gaa-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    margin-top: 1.2rem;
}

.card-tight {
    margin-top: 0.8rem;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 0.75rem;
}

th {
    color: var(--gaa-gray);
    font-size: 0.92rem;
}

.table-row-link {
    cursor: pointer;
}

.table-row-link:hover {
    background: #f4faf8;
}

.table-row-link:focus {
    outline: 2px solid var(--gaa-green);
    outline-offset: -2px;
}

.stance-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
}

.stance-badge--support {
    background: #dff4ea;
    color: #137a4b;
}

.stance-badge--watching {
    background: #fff2dc;
    color: var(--amber);
}

.stance-badge--oppose {
    background: #fde4e2;
    color: var(--red);
}

.stance-badge--neutral {
    background: #eceff1;
    color: #5f6870;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
}

.field-block label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.field-block--wide {
    grid-column: 1 / -1;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #c8d8d2;
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    font: inherit;
    background: #fcfefd;
}

textarea[name$="summary"],
textarea[id*="summary"] {
    min-height: 170px;
    resize: vertical;
}

.primary-button {
    margin-top: 0.7rem;
    border: 0;
    background: var(--gaa-green);
    color: var(--gaa-white);
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.secondary-button {
    border: 1px solid #b8cdc6;
    background: #f3f8f6;
    color: #234037;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.bill-create-switch {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.edit-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.bill-edit-panel h3 {
    margin-top: 0;
}

.bill-hero {
    background: linear-gradient(145deg, #f2fbf7, #edf7f3);
    border: 1px solid #d3e7df;
    border-radius: 12px;
    padding: 0.85rem 1rem 0.95rem;
}

.bill-hero__meta-label {
    margin: 0;
    color: #5f7b73;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.74rem;
}

.bill-chip-row {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bill-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.bill-chip--green {
    background: #dff4ea;
    color: #176744;
}

.bill-chip--green-soft {
    background: #ecf8f2;
    color: #236f52;
}

.bill-chip--amber {
    background: #fff2dc;
    color: #8f5d00;
}

.bill-chip--gray {
    background: #eceff1;
    color: #5f6870;
}

.bill-meta-grid {
    margin-top: 0.9rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.bill-meta-item {
    background: #f9fcfb;
    border: 1px solid #dce8e3;
    border-radius: 10px;
    padding: 0.7rem;
}

.bill-meta-item__label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #587169;
    margin-bottom: 0.35rem;
}

.bill-meta-empty {
    color: #6a7a76;
}

.bill-committee-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.bill-summary-panel {
    margin-top: 0.9rem;
    border: 1px solid #d9e7e2;
    background: #f7fbf9;
    border-radius: 10px;
    padding: 0.85rem;
}

.bill-summary-panel__label {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #557168;
}

.bill-summary-panel__text {
    margin: 0.45rem 0 0;
    max-width: 75ch;
    line-height: 1.5;
}

.bill-action-bar {
    margin-top: 0.9rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.bill-link-btn {
    text-decoration: none;
}

.collapse-card {
    position: relative;
}

.collapse-summary p {
    margin: 0.35rem 0;
}

.collapse-actions {
    margin-top: 0.9rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.collapse-toggle {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #29584a;
    cursor: pointer;
    user-select: none;
}

.collapse-toggle:hover {
    text-decoration: underline;
}

.inline-edit-form {
    border: 1px solid #d8e6e1;
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #fbfefd;
}

.inline-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.7rem;
}

.delete-text {
    border: 0;
    background: transparent;
    color: #9d2b2b;
    font-weight: 700;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.row-editor {
    border: 1px solid #dbe8e3;
    border-radius: 10px;
    background: #fbfefd;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.65rem;
}

.row-editor--democratic {
    border-left: 4px solid #1e40af;
    background: #f4f8ff;
}

.row-editor--republican {
    border-left: 4px solid #b91c1c;
    background: #fff6f6;
}

.row-editor__view {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.row-editor__view p {
    margin: 0;
}

.row-editor__trigger {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #3f5f56;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease-in-out;
}

.row-editor:hover .row-editor__trigger {
    opacity: 1;
}

.row-editor:hover .delete-text {
    opacity: 1;
}

.sponsor-party-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.sponsor-party-pill--democratic {
    background: #dbeafe;
    color: #1e40af;
}

.sponsor-party-pill--republican {
    background: #fee2e2;
    color: #b91c1c;
}

.sponsor-party-pill--bipartisan {
    background: #fef3c7;
    color: #92400e;
}

.sponsor-party-pill--neutral {
    background: #eceff1;
    color: #5f6870;
}

.error {
    color: #b42318;
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

.help-text {
    color: #4b5d62;
    font-size: 0.9rem;
    margin: 0.35rem 0 0;
}

.import-status {
    margin-top: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.92rem;
    display: none;
}

.import-status--working {
    display: block;
    background: #edf7f3;
    border: 1px solid #b8ddd0;
    color: #175f4b;
}

.import-status--success {
    display: block;
    background: #e8f7ee;
    border: 1px solid #a9d8bd;
    color: #165f42;
}

.import-status--error {
    display: block;
    background: #fdecea;
    border: 1px solid #f4b8b2;
    color: #8f1d1d;
}

.flash-group {
    display: grid;
    gap: 0.5rem;
}

.flash {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    background: #e8f6ef;
    color: #105a47;
    border: 1px solid #a8d7c7;
}

.flash-error {
    background: #fdecea;
    color: #8f1d1d;
    border: 1px solid #f4b8b2;
}

.auth-card {
    max-width: 460px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.auth-card h1 {
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    margin-top: 0;
    color: #557168;
}

.auth-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #5a6f69;
}

.modal {
    display: none;
}

.is-hidden {
    display: none !important;
}

.modal--open {
    display: block;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 39, 35, 0.65);
    z-index: 30;
}

.modal-dialog {
    position: fixed;
    z-index: 31;
    inset: 4vh 5vw;
    background: #f8fcfa;
    border-radius: 14px;
    padding: 1rem;
    overflow-y: auto;
}

.modal-close {
    border: 0;
    background: #e2ece8;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.modal-header h2 {
    margin-bottom: 0.25rem;
}

.inline-add-form {
    margin-top: 0.65rem;
}

.tag-multiselect select[multiple],
.tag-multiselect__native {
    display: none !important;
}

.tag-multiselect__control {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.35rem;
    border: 1px solid #c8d8d2;
    border-radius: 8px;
    background: #fcfefd;
}

.tag-multiselect__selected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tag-multiselect__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #dff4ea;
    color: #176744;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.tag-multiselect__remove {
    border: 0;
    background: transparent;
    color: #176744;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.tag-multiselect__chooser {
    border: 0;
    padding: 0.3rem 0.4rem;
    min-width: 170px;
    width: auto;
    background: transparent;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
    }

    .modal-dialog {
        inset: 2vh 3vw;
    }

    .bill-meta-grid {
        grid-template-columns: 1fr;
    }
}
