:root {
    /* Base palette */
    --tp-primary: #2563eb;
    --tp-primary-dark: #1d4ed8;
    --tp-primary-light: #eff6ff;
    --tp-muted: #64748b;
    --tp-border: #e2e8f0;
    --tp-surface: #ffffff;
    --tp-bg: #f8fafc;
    --tp-text: #1e293b;
    --tp-text-dark: #0f172a;
    --tp-text-secondary: #334155;

    /* Component colors */
    --tp-header-bg: var(--tp-surface);
    --tp-header-border: var(--tp-border);
    --tp-header-title: #0f172a;
    --tp-header-title-size: clamp(1.75rem, 4vw, 2.75rem);
    --tp-header-title-weight: 600;
    --tp-header-title-line-height: 1.1;
    --tp-header-title-spacing: -0.025em;
    --tp-header-title-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tp-header-title-hover: #1e293b;
    --tp-header-subtitle: #475569;
    --tp-header-subtitle-size: clamp(0.9375rem, 2.2vw, 1.0625rem);
    --tp-header-subtitle-weight: 500;
    --tp-header-subtitle-margin-top: 0.375rem;
    --tp-header-subtitle-line-height: 1.3;
    --tp-header-subtitle-spacing: 0.005em;
    --tp-nav-text: var(--tp-text-secondary);
    --tp-nav-hover: var(--tp-primary);
    --tp-nav-active-bg: var(--tp-primary);
    --tp-nav-active-text: #ffffff;
    --tp-title-bg: var(--tp-primary);
    --tp-title-bg-dark: var(--tp-primary-dark);
    --tp-title-text: #ffffff;
    --tp-footer-bg: #1e293b;
    --tp-footer-text: #cbd5e1;
    --tp-footer-link: #e2e8f0;
    --tp-footer-hover: #fbbf24;
    --tp-footer-muted: #a8b8cc;
    --tp-table-header-bg: var(--tp-footer-bg);
    --tp-table-header-text: #ffffff;
    --tp-accordion-bg: #f1f5f9;
    --tp-accordion-text: var(--tp-text-dark);
    --tp-accordion-active-bg: var(--tp-primary-light);
    --tp-accordion-active-text: var(--tp-primary-dark);

    /* Search */
    --tp-search-bg: var(--tp-surface);
    --tp-search-border: var(--tp-border);
    --tp-search-text: var(--tp-text);
    --tp-search-icon: var(--tp-muted);
    --tp-search-btn-bg: var(--tp-surface);
    --tp-search-btn-border: var(--tp-border);
    --tp-search-btn-hover: var(--tp-primary);

    /* Typography */
    --tp-font-size-base: 16px;
    --tp-font-size-sm: 14px;
    --tp-font-size-lg: 18px;
    --tp-font-size-xl: 20px;
    --tp-font-size-2xl: 24px;
    --tp-line-height-base: 1.5;

    /* Shapes */
    --tp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --tp-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --tp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --tp-shadow-return-to-top: 0 6px 12px rgba(37, 99, 235, 0.3);
    --tp-radius: 0.5rem;
    --tp-radius-lg: 0.75rem;
}

/* Skip to content */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    background: var(--tp-primary);
    color: #fff;
    border-radius: var(--tp-radius);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--tp-shadow-md);
}
.skip-link:focus {
    top: 1rem;
    color: #fff;
}

/* Focus indicators (WCAG 2.1 AA) */

:focus-visible {
    outline: 2px solid var(--tp-primary);
    outline-offset: 2px;
}
a:focus-visible {
    outline: 2px solid var(--tp-primary);
    outline-offset: 2px;
    border-radius: 2px;
}
.btn:focus-visible {
    outline: 2px solid var(--tp-primary);
    outline-offset: 2px;
    box-shadow: none;
}
.form-control:focus-visible {
    outline: none;
}

body {
    min-height: 100vh;
    background: var(--tp-bg);
    color: var(--tp-text);
    -webkit-font-smoothing: antialiased;
    font-size: var(--tp-font-size-base, 16px);
    line-height: var(--tp-line-height-base, 1.5);
}

a {
    color: var(--tp-primary);
    transition: color 0.2s;
}
a:hover {
    color: var(--tp-primary-dark);
}


/* Header */

#header {
    background: var(--tp-header-bg);
    border-bottom: 1px solid var(--tp-header-border);
    border-radius: var(--tp-radius-lg);
    margin-top: 1rem;
}
#header .navbar-toggler {
    border: none;
    padding: 0.375rem 0.5rem;
}
#header .navbar-toggler:focus {
    box-shadow: none;
}
#header .navbar-toggler:focus-visible {
    outline: 2px solid var(--tp-primary);
    outline-offset: 2px;
}


/* Search */

.btn-search {
    border-color: var(--tp-search-btn-border);
    background: var(--tp-search-btn-bg);
    color: var(--tp-search-icon);
    transition: all 0.2s;
}
.btn-search:hover {
    background: var(--tp-search-btn-hover);
    border-color: var(--tp-search-btn-hover);
    color: var(--tp-search-icon);
}
.form-control:focus {
    border-color: var(--tp-search-border);
    background: var(--tp-search-bg);
    color: var(--tp-search-text);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}


/* Side navigation */

#navbar-categories nav.list-group {
    font-size: var(--tp-font-size-sm, 14px);
    gap: 2px;
}
#navbar-categories .list-group-item {
    border: none;
    border-radius: var(--tp-radius);
    padding: 0.625rem 1rem;
    min-height: 44px;
    transition: all 0.2s;
    color: var(--tp-nav-text);
}
#navbar-categories a.list-group-item:hover {
    background: var(--tp-primary-light);
    color: var(--tp-nav-hover);
}
#navbar-categories a.list-group-item.active {
    color: var(--tp-nav-active-text);
    background: var(--tp-nav-active-bg);
    box-shadow: var(--tp-shadow-sm);
}
#navbar-categories a.list-group-item:focus-visible {
    outline: 2px solid var(--tp-primary);
    outline-offset: -2px;
}


/* Top nav links */

#navbar-links li {
    margin-inline: 0.75rem;
}
#navbar-links .nav-link {
    color: var(--tp-nav-text);
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
#navbar-links .nav-link:hover {
    color: var(--tp-nav-hover);
    border-bottom-color: var(--tp-nav-hover);
}


/* Sub-header */

#sub-header {
    margin-bottom: 0;
}
#sub-header img {
    border-radius: var(--tp-radius-lg);
    box-shadow: var(--tp-shadow);
    overflow: hidden;
    display: block;
}


/* Content */

#content {
    background: var(--tp-surface);
    border-radius: var(--tp-radius-lg);
    box-shadow: var(--tp-shadow-sm);
    padding-top: 1rem;
    padding-bottom: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}


/* Breadcrumbs */

#breadcrumbs {
    font-size: var(--tp-font-size-sm, 14px);
}
#breadcrumbs .breadcrumb {
    padding: 0;
    margin-bottom: 0.75rem;
}
#breadcrumbs .breadcrumb-item a {
    color: var(--tp-muted);
    text-decoration: none;
}
#breadcrumbs .breadcrumb-item a:hover {
    color: var(--tp-primary);
}
#breadcrumbs .breadcrumb-item.active {
    color: var(--tp-text-secondary);
}


/* Footer */

#footer {
    color: var(--tp-footer-text);
    background: var(--tp-footer-bg) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 2rem;
    padding-bottom: 2rem;
}
#footer a {
    color: var(--tp-footer-link);
    text-decoration: none;
    transition: color 0.2s;
}
#footer a:hover {
    color: var(--tp-footer-hover);
    text-decoration: none;
}
#footer a.nav-link {
    color: var(--tp-footer-link);
    font-weight: 500;
    font-size: var(--tp-font-size-sm, 14px);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
#footer a.nav-link:hover {
    color: var(--tp-footer-hover);
}
#footer .small {
    color: var(--tp-footer-muted);
}


/* Logo */

.logo {
    max-width: 200px;
    transition: opacity 0.2s;
}
.logo:hover {
    opacity: 0.85;
}


/* Header title */

.header-title {
    color: var(--tp-header-title, #0f172a);
    font-size: var(--tp-header-title-size, clamp(1.75rem, 4vw, 2.75rem));
    font-weight: var(--tp-header-title-weight, 600);
    line-height: var(--tp-header-title-line-height, 1.1);
    text-decoration: none;
    letter-spacing: var(--tp-header-title-spacing, -0.025em);
    font-family: var(--tp-header-title-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
}
a.header-title:hover {
    color: var(--tp-header-title-hover, #1e293b);
    text-decoration: none;
}
a.header-title small {
    font-size: var(--tp-header-subtitle-size, clamp(0.9375rem, 2.2vw, 1.0625rem));
    font-weight: var(--tp-header-subtitle-weight, 500);
    color: var(--tp-header-subtitle, #475569);
    display: block;
    margin-top: var(--tp-header-subtitle-margin-top, 0.375rem);
    line-height: var(--tp-header-subtitle-line-height, 1.3);
    letter-spacing: var(--tp-header-subtitle-spacing, 0.005em);
}


/* Page title banner */

.title {
    color: var(--tp-title-text);
    background: linear-gradient(135deg, var(--tp-title-bg), var(--tp-title-bg-dark));
    margin-bottom: 1.5rem;
    display: flex;
    border-radius: var(--tp-radius);
    box-shadow: var(--tp-shadow);
}
.title h1 {
    margin-bottom: 0;
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: var(--tp-font-size-xl, 20px);
    letter-spacing: -0.01em;
    line-height: var(--tp-line-height-base, 1.5);
}


/* Category pages block */

.category-pages {
    padding-inline: 1.5rem;
}
.category-pages h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tp-text-dark);
    margin-bottom: 1rem;
}
.category-pages ul {
    list-style: none;
    padding: 0;
}
.category-pages li {
    padding: 0.375rem 0;
}
.category-pages li a {
    text-decoration: none;
    font-weight: 500;
}
.category-pages li a:hover {
    text-decoration: underline;
}


/* Accordion */

.accordion {
    margin-bottom: 0.75rem;
}
.accordion-item {
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius) !important;
    overflow: hidden;
}
.accordion-button {
    font-weight: 600;
    font-size: 0.9375rem;
    background: var(--tp-accordion-bg);
    color: var(--tp-accordion-text);
    padding: 0.875rem 1.25rem;
}
.accordion-button:not(.collapsed) {
    background: var(--tp-accordion-active-bg);
    color: var(--tp-accordion-active-text);
    box-shadow: none;
}
.accordion-button:focus {
    box-shadow: none;
}
.accordion-button:focus-visible {
    outline: 2px solid var(--tp-primary);
    outline-offset: -2px;
}
.accordion-body {
    padding: 1.25rem;
}


/* Document tables */

.documents-group {
    border-radius: var(--tp-radius);
    box-shadow: var(--tp-shadow-sm);
}
.documents-group .table {
    margin-bottom: 0;
}
.documents-group th {
    color: var(--tp-table-header-text);
    background: var(--tp-table-header-bg);
    vertical-align: middle !important;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
}
.documents-group td {
    vertical-align: middle;
    padding: 0.75rem 1rem;
    border-color: var(--tp-border);
}
.documents-group tbody tr {
    transition: background 0.15s;
}
.documents-group tbody tr:hover {
    background: var(--tp-primary-light);
}


/* Transparency info block */

.transparency-info {
    font-size: 0.8125rem;
    color: var(--tp-muted);
    line-height: 1.8;
}
.transparency-info hr {
    border: none;
    border-top: 3px solid var(--tp-primary);
    opacity: 1;
    margin-bottom: 0.75rem;
}


/* Stats block */

.stats {
    overflow: hidden;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-lg);
    transition: box-shadow 0.2s, transform 0.2s;
}
.stats:hover {
    box-shadow: var(--tp-shadow-md);
    transform: translateY(-2px);
}
.stats .card-body {
    text-align: center;
    padding: 1.5rem;
}
.stats h5.card-title {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--tp-text-dark);
}
.stats h6.card-subtitle {
    margin: 1rem 0;
    color: var(--tp-muted);
    font-weight: 400;
}
.stats .card-text {
    margin: 1.25rem 0;
    padding: 1.25rem;
    font-weight: 600;
    border: 2px dashed var(--tp-border);
    background: var(--tp-bg);
    border-radius: var(--tp-radius);
}
.stats .btn {
    border-radius: var(--tp-radius);
    font-weight: 600;
    padding: 0.5rem 1.5rem;
}


/* Member profile */

.member-profile {
    border: none;
    background: var(--tp-bg);
}
.member-profile:hover {
    box-shadow: none;
}
.member-photo {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border: 3px solid var(--tp-border);
    box-shadow: var(--tp-shadow);
}
.social-link {
    color: var(--tp-text-secondary);
    transition: color 0.2s, transform 0.2s;
}
.social-link:hover {
    color: var(--tp-primary);
    transform: scale(1.15);
}

/* Buttons */

.btn {
    border-radius: var(--tp-radius);
    font-weight: 500;
    transition: all 0.2s;
}

/* Primary button */
.btn-primary {
    background: var(--tp-primary);
    border-color: var(--tp-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--tp-primary-dark);
    border-color: var(--tp-primary-dark);
    color: #ffffff;
}
.btn-primary:active,
.btn-primary:focus,
.btn-primary.active {
    background: var(--tp-primary-dark) !important;
    border-color: var(--tp-primary-dark) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

/* Primary outline button */
.btn-outline-primary {
    color: var(--tp-primary);
    border-color: var(--tp-primary);
    background-color: transparent;
}
.btn-outline-primary:hover {
    color: #ffffff;
    background-color: var(--tp-primary);
    border-color: var(--tp-primary);
}
.btn-outline-primary:active,
.btn-outline-primary:focus,
.btn-outline-primary.active {
    color: #ffffff !important;
    background-color: var(--tp-primary) !important;
    border-color: var(--tp-primary) !important;
    box-shadow: none !important;
}


/* Elected members table */

.template-electedmemberspage .table {
    border-radius: var(--tp-radius);
    overflow: hidden;
    box-shadow: var(--tp-shadow-sm);
}
.template-electedmemberspage .table thead th {
    background: var(--tp-table-header-bg);
    color: var(--tp-table-header-text);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
}
.template-electedmemberspage .table tbody tr {
    transition: background 0.15s;
}
.template-electedmemberspage .table tbody tr:hover {
    background: var(--tp-primary-light);
}


/* Cards */

.card {
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius);
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: var(--tp-shadow);
}




/* Return to top */

#return-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--tp-return-to-top-bg, #2563eb);
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 1000;
    cursor: pointer;
    box-shadow: var(--tp-shadow-md);
    border: 2px solid #fff;
}
#return-to-top i {
    color: var(--tp-return-to-top-icon, #fff);
    font-size: 1rem;
}
#return-to-top:hover {
    background: var(--tp-return-to-top-hover, #1d4ed8);
    transform: translateY(-3px);
    box-shadow: var(--tp-shadow-return-to-top);
    border-color: #fff;
}
#return-to-top:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

canvas {
    max-width: 768px;
    float: left;
}


/* Responsive */

@media (max-width: 767.98px) {
    .logo {
        margin-bottom: 1em;
    }
    .header-title {
        font-size: 1.375em;
    }
    .title h1 {
        font-size: 1.25rem;
        padding: 0.875rem 1rem;
    }
    #content {
        border-radius: 0;
        box-shadow: none;
        margin-top: 0;
    }
}

@media (min-width: 768px) {
    #navbar-categories {
        display: block !important;
    }
}
