/* =============================================================================
   eCRACY Grassroots Democracy — admin panel base styles (plain CSS, no build step)
   Reset, layout (sidebar + topbar), and the shared components used by every
   admin page: page header, sections, buttons, forms, tables, badges, alerts.
   Brand pieces and dashboard widgets live in theme.css.
   ========================================================================== */

/* --------------------------------------------------------------- Tokens ---- */

:root {
    --primary-50: #eef4ff;
    --primary-100: #dbe7fe;
    --primary-200: #bfd3fd;
    --primary-300: #93b4fb;
    --primary-400: #5f8cf5;
    --primary-500: #2f63e0;
    --primary-600: #1a4cc0;
    --primary-700: #0b3d91;
    --primary-800: #0a3277;
    --primary-900: #0a2a63;
    --primary-950: #061637;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --success-50: #f0fdf4;
    --success-600: #16a34a;
    --success-700: #15803d;
    --danger-50: #fff1f2;
    --danger-600: #e11d48;
    --danger-700: #be123c;
    --warning-50: #fffbeb;
    --warning-600: #d97706;
    --warning-700: #b45309;
    --info-50: #f0f9ff;
    --info-600: #0284c7;
    --info-700: #0369a1;

    --ec-font: 'Google Sans', 'Hind Siliguri', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ec-sidebar-width: 17rem;
    --ec-topbar-height: 4rem;
}

/* ---------------------------------------------------------------- Reset ---- */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0 solid;
}

html {
    -webkit-text-size-adjust: 100%;
    line-height: 1.5;
    font-family: var(--ec-font);
    color: var(--gray-900);
}

body {
    min-height: 100dvh;
    background-color: #f3f6fb;
    -webkit-font-smoothing: antialiased;
}

img,
svg,
picture,
canvas {
    display: block;
    max-width: 100%;
}

svg {
    flex-shrink: 0;
}

a {
    color: inherit;
    text-decoration: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
    background: transparent;
}

button,
[role='button'],
summary {
    cursor: pointer;
}

ol,
ul {
    list-style: none;
}

table {
    border-collapse: collapse;
}

h1,
h2,
h3,
h4 {
    font-size: inherit;
    font-weight: inherit;
}

[hidden] {
    display: none !important;
}

summary::-webkit-details-marker {
    display: none;
}

summary {
    list-style: none;
}

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

:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.ec-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.ec-icon--sm {
    width: 1rem;
    height: 1rem;
}

/* --------------------------------------------------------------- Layout ---- */

.ec-app {
    min-height: 100dvh;
    background-color: #f3f6fb;
    background-image:
        radial-gradient(60rem 30rem at 100% -10%, rgb(30 136 229 / 0.09), transparent 60%),
        radial-gradient(50rem 28rem at -10% 110%, rgb(22 163 74 / 0.07), transparent 60%);
    background-attachment: fixed;
}

.ec-main {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    /* Safety net: nothing inside may widen the page sideways on phones (clip keeps the topbar sticky). */
    overflow-x: clip;
}

@media (min-width: 64rem) {
    .ec-main {
        padding-inline-start: var(--ec-sidebar-width);
    }
}

.ec-content {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 1.5rem 1rem 3rem;
}

@media (min-width: 40rem) {
    .ec-content {
        padding-inline: 1.5rem;
    }
}

@media (min-width: 80rem) {
    .ec-content {
        padding-inline: 2rem;
    }
}

/* -------------------------------------------------------------- Sidebar ---- */

.ec-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--ec-sidebar-width);
    background: var(--ec-sidebar-bg);
    color: #fff;
    box-shadow: var(--ec-shadow-xl);
    transform: translateX(-100%);
    transition: transform 0.2s var(--ec-ease);
}

[dir='rtl'] .ec-sidebar {
    transform: translateX(100%);
}

.ec-sidebar-open .ec-sidebar {
    transform: none;
}

@media (min-width: 64rem) {
    .ec-sidebar,
    [dir='rtl'] .ec-sidebar {
        transform: none;
    }
}

.ec-sidebar__backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    background: rgb(15 23 42 / 0.5);
}

.ec-sidebar-open .ec-sidebar__backdrop {
    display: block;
}

@media (min-width: 64rem) {
    .ec-sidebar-open .ec-sidebar__backdrop {
        display: none;
    }
}

.ec-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    height: var(--ec-topbar-height);
    padding-inline: 1.25rem;
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

.ec-sidebar__close {
    display: inline-flex;
    padding: 0.375rem;
    border-radius: 0.5rem;
    color: rgb(255 255 255 / 0.7);
}

.ec-sidebar__close:hover {
    color: #fff;
    background: rgb(255 255 255 / 0.1);
}

@media (min-width: 64rem) {
    .ec-sidebar__close {
        display: none;
    }
}

.ec-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    /* Still scrolls (wheel, touch, keyboard); only the bar is hidden. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ec-sidebar__nav::-webkit-scrollbar {
    display: none;
}

.ec-nav-group__label {
    padding-inline: 0.75rem;
    margin-bottom: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgb(186 230 253 / 0.7);
}

.ec-nav-group__items {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.ec-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgb(255 255 255 / 0.85);
    transition-property: var(--ec-transition);
    transition-duration: 150ms;
}

.ec-nav-item:hover,
.ec-nav-item:focus-visible {
    background-color: rgb(255 255 255 / 0.1);
    color: #fff;
}

.ec-nav-item .ec-icon {
    width: 1.375rem;
    height: 1.375rem;
    color: rgb(186 230 253 / 0.7);
}

.ec-nav-item__label {
    flex: 1;
    min-width: 0;
}

.ec-nav-item--active {
    background: linear-gradient(90deg, rgb(255 255 255 / 0.18), rgb(255 255 255 / 0.06));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.15), inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
}

.ec-nav-item--active::before {
    content: '';
    position: absolute;
    inset-block: 0.5rem;
    inset-inline-start: -1rem;
    width: 0.25rem;
    border-start-end-radius: 9999px;
    border-end-end-radius: 9999px;
    background-color: var(--ec-lime);
    box-shadow: 0 0 12px rgb(74 222 128 / 0.8);
}

.ec-nav-item--active .ec-icon {
    color: var(--ec-lime);
}

.ec-nav-item__badge {
    padding: 0 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    background: #fbbf24;
    color: #451a03;
}

.ec-sidebar__footer {
    border-top: 1px solid rgb(255 255 255 / 0.1);
}

/* --------------------------------------------------------------- Topbar ---- */

.ec-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--ec-topbar-height);
    padding-inline: 1rem;
    background-color: rgb(255 255 255 / 0.8);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid rgb(226 232 240 / 0.7);
}

@media (min-width: 40rem) {
    .ec-topbar {
        padding-inline: 1.5rem;
    }
}

.ec-topbar__toggle {
    display: inline-flex;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--gray-500);
}

.ec-topbar__toggle:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

@media (min-width: 64rem) {
    .ec-topbar__toggle {
        display: none;
    }
}

.ec-topbar__brand {
    display: flex;
}

@media (min-width: 64rem) {
    .ec-topbar__brand {
        display: none;
    }
}

.ec-topbar__end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-inline-start: auto;
}

/* ------------------------------------------------------------- Dropdown ---- */
/* <details class="ec-dropdown"><summary>…</summary><div class="ec-dropdown__panel">…</div></details> */

.ec-dropdown {
    position: relative;
}

.ec-dropdown__panel {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.5rem);
    z-index: 30;
    min-width: 14rem;
    padding: 0.375rem;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 0 0 1px rgb(15 23 42 / 0.06), var(--ec-shadow-lg);
}

.ec-dropdown__header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 0.25rem;
}

.ec-dropdown__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    text-align: start;
}

.ec-dropdown__item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.ec-dropdown__item .ec-icon {
    color: var(--gray-400);
}

.ec-avatar {
    flex-shrink: 0;
    max-width: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    object-fit: cover;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--gray-200);
}

.ec-avatar--xl {
    width: 4.5rem;
    height: 4.5rem;
    box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--gray-200), var(--ec-shadow-md);
}

.ec-profile-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ---------------------------------------------------------- Page header ---- */

.ec-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ec-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
}

.ec-breadcrumbs a:hover {
    color: var(--gray-700);
}

.ec-breadcrumbs .ec-icon {
    width: 1rem;
    height: 1rem;
    color: var(--gray-400);
}

.ec-page-header__title {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--gray-900);
}

@media (min-width: 40rem) {
    .ec-page-header__title {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }
}

.ec-page-header__subheading {
    margin-top: 0.25rem;
    max-width: 48rem;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.ec-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.ec-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ec-grid-2 {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 64rem) {
    .ec-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ec-grid-2__full {
        grid-column: 1 / -1;
    }
}

/* ------------------------------------------------------------- Sections ---- */

.ec-section {
    position: relative;
    min-width: 0;
    border-radius: var(--ec-radius);
    background-color: #fff;
    box-shadow: var(--ec-card-shadow);
}

.ec-section__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.ec-section__icon {
    box-sizing: content-box;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    color: var(--primary-600);
    background: color-mix(in oklab, currentColor 13%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 18%, transparent);
}

.ec-section__icon--success { color: var(--success-600); }
.ec-section__icon--warning { color: var(--warning-600); }
.ec-section__icon--danger { color: var(--danger-600); }
.ec-section__icon--info { color: var(--info-600); }
.ec-section__icon--purple { color: #7c3aed; }

.ec-section__titles {
    flex: 1;
    min-width: 0;
}

.ec-section__heading {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.ec-section__description {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.ec-section__header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.ec-section__body {
    padding: 1.5rem;
}

.ec-section__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
}

/* -------------------------------------------------------------- Buttons ---- */

.ec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    transition-property: var(--ec-transition);
    transition-duration: 150ms;
    background-color: #fff;
    color: var(--gray-700);
    box-shadow: 0 0 0 1px var(--gray-200), 0 1px 2px rgb(15 23 42 / 0.05);
}

.ec-btn:hover {
    background-color: var(--gray-50);
}

.ec-btn .ec-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.ec-btn--primary {
    color: #fff;
    background-image: linear-gradient(135deg, var(--primary-700), var(--primary-500));
    box-shadow:
        0 4px 6px -1px color-mix(in oklab, var(--primary-700) 25%, transparent),
        0 2px 4px -2px color-mix(in oklab, var(--primary-700) 25%, transparent);
}

.ec-btn--primary:hover {
    background-image: linear-gradient(135deg, var(--primary-800), var(--primary-600));
}

.ec-btn--danger {
    color: #fff;
    background-color: var(--danger-600);
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.1);
}

.ec-btn--danger:hover {
    background-color: var(--danger-700);
}

.ec-btn--success {
    color: #fff;
    background-color: var(--success-600);
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.1);
}

.ec-btn--success:hover {
    background-color: var(--success-700);
}

.ec-btn--warning {
    color: #fff;
    background-color: var(--warning-600);
}

.ec-btn--warning:hover {
    background-color: var(--warning-700);
}

.ec-btn--block {
    width: 100%;
}

.ec-btn--sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
}

/* Outline action buttons (edit, delete, approve…): coloured border and text, tinted on hover.
   Solid .ec-btn--primary stays for the page's main submit (Create, Save). */
.ec-btn[class*='ec-btn--outline-'] {
    background-color: transparent;
    background-image: none;
    color: var(--ec-outline);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ec-outline) 45%, transparent);
}

.ec-btn[class*='ec-btn--outline-']:hover {
    background-color: color-mix(in oklab, var(--ec-outline) 9%, transparent);
    box-shadow: inset 0 0 0 1px var(--ec-outline);
}

.ec-btn--outline-primary { --ec-outline: var(--primary-600); }
.ec-btn--outline-danger { --ec-outline: var(--danger-600); }
.ec-btn--outline-success { --ec-outline: var(--success-600); }
.ec-btn--outline-warning { --ec-outline: var(--warning-600); }
.ec-btn--outline-gray { --ec-outline: var(--gray-600); }

.ec-btn[aria-disabled='true'] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Text-only action links in table rows. */
.ec-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-600);
    white-space: nowrap;
}

.ec-link:hover {
    color: var(--primary-800);
    text-decoration: underline;
}

.ec-link .ec-icon {
    width: 1rem;
    height: 1rem;
}

.ec-link--danger {
    color: var(--danger-600);
}

.ec-link--danger:hover {
    color: var(--danger-700);
}

.ec-link--gray {
    color: var(--gray-600);
}

.ec-inline-form {
    display: inline;
}

/* ---------------------------------------------------------------- Forms ---- */

.ec-form-grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 48rem) {
    .ec-form-grid--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ec-form-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ec-field--full {
        grid-column: 1 / -1;
    }
}

.ec-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.ec-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.ec-label__required {
    color: var(--danger-600);
    margin-inline-start: 0.125rem;
}

.ec-input,
.ec-select,
.ec-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background-color: #fff;
    font-size: 0.9rem;
    line-height: 1.5rem;
    color: var(--gray-900);
    box-shadow: 0 0 0 1px var(--gray-300), 0 1px 2px rgb(15 23 42 / 0.04);
    transition: box-shadow 150ms var(--ec-ease);
}

.ec-input::placeholder,
.ec-textarea::placeholder {
    color: var(--gray-400);
}

.ec-input:focus,
.ec-select:focus,
.ec-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-500);
}

.ec-input:disabled,
.ec-select:disabled,
.ec-textarea:disabled,
.ec-input[readonly] {
    background-color: var(--gray-50);
    color: var(--gray-500);
}

.ec-select {
    appearance: none;
    padding-inline-end: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1.25rem;
}

[dir='rtl'] .ec-select {
    background-position: left 0.625rem center;
}

.ec-select[multiple] {
    padding-inline-end: 0.75rem;
    background-image: none;
}

.ec-textarea {
    min-height: 6rem;
    resize: vertical;
}

.ec-field--invalid .ec-input,
.ec-field--invalid .ec-select,
.ec-field--invalid .ec-textarea {
    box-shadow: 0 0 0 1px var(--danger-600);
}

.ec-help {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.ec-error {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--danger-600);
}

.ec-check {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

.ec-check input {
    width: 1rem;
    height: 1rem;
    margin-top: 0.1875rem;
    accent-color: var(--primary-600);
    flex-shrink: 0;
}

.ec-check__hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* Toggle switch: <label class="ec-toggle"><input type="checkbox"><span class="ec-toggle__track"></span> Label</label> */
.ec-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
}

.ec-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.ec-toggle__track {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: var(--gray-200);
    transition: background-color 150ms var(--ec-ease);
}

.ec-toggle__track::after {
    content: '';
    position: absolute;
    top: 0.125rem;
    inset-inline-start: 0.125rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    background: #fff;
    box-shadow: var(--ec-shadow-sm);
    transition: translate 150ms var(--ec-ease);
}

.ec-toggle input:checked + .ec-toggle__track {
    background: var(--primary-600);
}

.ec-toggle input:checked + .ec-toggle__track::after {
    translate: 1.25rem 0;
}

[dir='rtl'] .ec-toggle input:checked + .ec-toggle__track::after {
    translate: -1.25rem 0;
}

.ec-toggle input:focus-visible + .ec-toggle__track {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.ec-toggle input:disabled + .ec-toggle__track {
    opacity: 0.5;
}

.ec-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Checkbox list in columns (permission pickers). */
.ec-check-grid {
    display: grid;
    gap: 0.75rem 1.5rem;
}

@media (min-width: 48rem) {
    .ec-check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 80rem) {
    .ec-check-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.ec-fieldset {
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 0 0 1px var(--gray-200);
}

.ec-fieldset__legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.ec-fieldset__legend .ec-icon {
    width: 1.125rem;
    height: 1.125rem;
}

/* --------------------------------------------------------------- Tables ---- */

/* position: relative keeps absolutely positioned children (screen-reader text in cells)
   inside the card's clipping, so wide tables scroll inside the card, not the page. */
.ec-table-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--ec-radius);
    background-color: #fff;
    box-shadow: var(--ec-card-shadow);
}

.ec-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.ec-table-toolbar__filters {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.ec-table-toolbar__filter {
    flex: 0 1 10rem;
    min-width: 7.5rem;
    gap: 0.25rem;
}

.ec-table-toolbar__filter--narrow {
    flex-basis: 5rem;
    min-width: 5rem;
}

.ec-table-toolbar__filter .ec-label {
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--gray-500);
}

.ec-table-toolbar__filter .ec-select,
.ec-table-toolbar__filter .ec-input,
.ec-search .ec-input {
    height: 2.125rem;
    padding-block: 0;
    padding-inline-start: 0.625rem;
    border-radius: 0.625rem;
    font-size: 0.8125rem;
    line-height: 2.125rem;
}

.ec-table-toolbar__filter .ec-select {
    padding-inline-end: 1.875rem;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

[dir='rtl'] .ec-table-toolbar__filter .ec-select {
    background-position: left 0.5rem center;
}

.ec-table-toolbar__end {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-inline-start: auto;
}

.ec-table-toolbar__reset {
    height: 2.125rem;
    padding-block: 0;
    font-size: 0.8125rem;
}

.ec-search {
    position: relative;
    width: 100%;
}

@media (min-width: 40rem) {
    .ec-search {
        width: 15rem;
    }
}

.ec-search .ec-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 0.625rem;
    translate: 0 -50%;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--gray-400);
    pointer-events: none;
}

.ec-search .ec-input {
    padding-inline-start: 2.125rem;
}

.ec-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    background-color: rgb(255 255 255 / 0.7);
    box-shadow: 0 0 0 1px rgb(226 232 240 / 0.8), var(--ec-shadow-sm);
}

.ec-tabs__item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
}

.ec-tabs__item:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.ec-tabs__item .ec-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.ec-tabs__item--active,
.ec-tabs__item--active:hover {
    color: #fff;
    background-image: linear-gradient(135deg, var(--primary-700), var(--primary-500));
    box-shadow: var(--ec-shadow-md);
}

.ec-tabs__count {
    padding: 0 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1.25rem;
    background: var(--gray-100);
    color: var(--gray-600);
}

.ec-tabs__item--active .ec-tabs__count {
    background: rgb(255 255 255 / 0.2);
    color: #fff;
}

.ec-table-wrap {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ec-table {
    width: 100%;
    font-size: 0.875rem;
    text-align: start;
}

.ec-table th {
    padding: 0.75rem 1rem;
    background-color: rgb(248 250 252 / 0.8);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    text-align: start;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-200);
}

.ec-table th a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ec-table th a:hover {
    color: var(--gray-800);
}

.ec-table th .ec-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.ec-table td {
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    vertical-align: middle;
}

.ec-table tbody tr {
    border-top: 1px solid var(--gray-100);
    transition: background-color 100ms var(--ec-ease);
}

.ec-table tbody tr:first-child {
    border-top: 0;
}

.ec-table tbody tr:nth-child(even) {
    background-color: #f5f8fc;
}

.ec-table tbody tr:hover {
    background-color: color-mix(in oklab, var(--primary-100) 70%, transparent);
}

.ec-table__primary {
    font-weight: 500;
    color: var(--gray-900);
}

.ec-table__secondary {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.ec-table__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.875rem;
}

.ec-table__num {
    font-variant-numeric: tabular-nums;
}

.ec-table__wrap {
    min-width: 14rem;
    white-space: normal;
}

.ec-empty {
    padding: 3rem 1.5rem;
    text-align: center;
}

.ec-empty__icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    padding: 0.75rem;
    border-radius: 9999px;
    background: var(--gray-100);
    color: var(--gray-400);
}

.ec-empty__title {
    font-weight: 600;
    color: var(--gray-900);
}

.ec-empty__hint {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.ec-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.875rem;
    color: var(--gray-500);
}

.ec-pagination__pages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.ec-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding-inline: 0.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

a.ec-pagination__page:hover {
    background: var(--gray-100);
}

.ec-pagination__page--active {
    color: #fff;
    background: var(--primary-600);
}

.ec-pagination__page--disabled {
    color: var(--gray-300);
}

/* --------------------------------------------------------------- Badges ---- */

.ec-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1.25rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--gray-700);
    background-color: var(--gray-100);
    box-shadow: inset 0 0 0 1px rgb(100 116 139 / 0.15);
}

.ec-badge .ec-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.ec-badge--lg {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}

.ec-badge--primary { color: var(--primary-700); background-color: var(--primary-50); box-shadow: inset 0 0 0 1px rgb(26 76 192 / 0.2); }
.ec-badge--success { color: var(--success-700); background-color: var(--success-50); box-shadow: inset 0 0 0 1px rgb(22 163 74 / 0.2); }
.ec-badge--danger { color: var(--danger-700); background-color: var(--danger-50); box-shadow: inset 0 0 0 1px rgb(225 29 72 / 0.2); }
.ec-badge--warning { color: var(--warning-700); background-color: var(--warning-50); box-shadow: inset 0 0 0 1px rgb(217 119 6 / 0.25); }
.ec-badge--info { color: var(--info-700); background-color: var(--info-50); box-shadow: inset 0 0 0 1px rgb(2 132 199 / 0.2); }
.ec-badge--purple { color: #6d28d9; background-color: #f5f3ff; box-shadow: inset 0 0 0 1px rgb(124 58 237 / 0.2); }
.ec-badge--orange { color: #c2410c; background-color: #fff7ed; box-shadow: inset 0 0 0 1px rgb(249 115 22 / 0.2); }
.ec-badge--teal { color: #0f766e; background-color: #f0fdfa; box-shadow: inset 0 0 0 1px rgb(13 148 136 / 0.2); }
.ec-badge--gray { color: var(--gray-700); background-color: var(--gray-100); }

.ec-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.ec-bool {
    width: 1.25rem;
    height: 1.25rem;
}

.ec-bool--yes { color: var(--success-600); }
.ec-bool--no { color: var(--gray-300); }

/* --------------------------------------------------------------- Alerts ---- */

.ec-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background: var(--info-50);
    color: var(--info-700);
    box-shadow: inset 0 0 0 1px rgb(2 132 199 / 0.15);
}

.ec-alert--success { background: var(--success-50); color: var(--success-700); box-shadow: inset 0 0 0 1px rgb(22 163 74 / 0.2); }
.ec-alert--danger { background: var(--danger-50); color: var(--danger-700); box-shadow: inset 0 0 0 1px rgb(225 29 72 / 0.2); }
.ec-alert--warning { background: var(--warning-50); color: var(--warning-700); box-shadow: inset 0 0 0 1px rgb(217 119 6 / 0.2); }

.ec-alert__title {
    font-weight: 600;
}

/* Toast notifications (flash messages), top-end corner. */
.ec-toasts {
    position: fixed;
    top: 1rem;
    inset-inline-end: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(24rem, calc(100vw - 2rem));
}

.ec-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: #fff;
    font-size: 0.875rem;
    color: var(--gray-800);
    box-shadow: 0 0 0 1px rgb(15 23 42 / 0.06), var(--ec-shadow-lg);
    transition: opacity 0.3s ease, translate 0.3s ease;
}

.ec-toast--hiding {
    opacity: 0;
    translate: 0 -0.5rem;
}

.ec-toast__icon--success { color: var(--success-600); }
.ec-toast__icon--danger { color: var(--danger-600); }
.ec-toast__icon--warning { color: var(--warning-600); }

.ec-toast__body {
    flex: 1;
}

.ec-toast__title {
    font-weight: 600;
    color: var(--gray-900);
}

.ec-toast__close {
    color: var(--gray-400);
}

.ec-toast__close:hover {
    color: var(--gray-600);
}

/* -------------------------------------------------- Description lists ---- */

.ec-dl {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 48rem) {
    .ec-dl--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ec-dl--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.ec-dl__term {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-500);
}

.ec-dl__value {
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--gray-900);
    overflow-wrap: anywhere;
}

.ec-dl__full {
    grid-column: 1 / -1;
}

.ec-photo {
    width: 8rem;
    height: 8rem;
    border-radius: 0.75rem;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--gray-200);
}

.ec-photo--wide {
    width: auto;
    max-width: 100%;
    height: 10rem;
}

/* ------------------------------------------------------------ Auth pages ---- */

.ec-auth {
    display: flex;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background-color: #f3f6fb;
    background-image:
        radial-gradient(60rem 30rem at 100% -10%, rgb(30 136 229 / 0.09), transparent 60%),
        radial-gradient(50rem 28rem at -10% 110%, rgb(22 163 74 / 0.07), transparent 60%);
}

.ec-auth__card {
    width: 100%;
    max-width: 28rem;
    padding: 2.5rem 2rem;
    border-radius: 1.5rem;
    background-color: rgb(255 255 255 / 0.9);
    box-shadow: 0 0 0 1px rgb(226 232 240 / 0.8), 0 25px 50px -12px rgb(15 23 42 / 0.1);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.ec-auth__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.ec-auth__heading {
    text-align: center;
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--gray-900);
}

.ec-auth__subheading {
    margin-top: 0.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.ec-auth__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
}

.ec-auth__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ec-auth__footer {
    margin-top: 1.5rem;
}

@media (min-width: 64rem) {
    .ec-auth--hero {
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        align-items: stretch;
        padding: 0;
    }

    .ec-auth--hero .ec-auth-hero {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 2.5rem;
        min-height: 100dvh;
        overflow: hidden;
        padding: 3rem;
        color: #fff;
        background: var(--ec-brand-gradient);
    }

    .ec-auth--hero .ec-auth__main {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem;
    }
}

@media (min-width: 80rem) {
    .ec-auth--hero .ec-auth-hero {
        padding: 4rem;
    }
}

.ec-auth__main {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* Public static pages (privacy, terms, account deletion) in the sign-in layout. */

.ec-auth__card--wide {
    max-width: 46rem;
}

.ec-auth__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
}

.ec-auth__links .ec-btn {
    flex: 1 1 auto;
}

.ec-auth__links .ec-btn[aria-current="page"] {
    border-color: var(--ec-primary, #0b3d91);
    color: var(--ec-primary, #0b3d91);
    background-color: rgb(11 61 145 / 0.06);
}

.ec-legal {
    margin-top: 1.5rem;
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.8;
}

.ec-legal h2 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
}

.ec-legal p {
    margin: 0.5rem 0;
}

.ec-legal ul,
.ec-legal ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.ec-legal ul {
    list-style: disc;
}

.ec-legal ol {
    list-style: decimal;
}

.ec-legal li::marker {
    color: var(--gray-400, #94a3b8);
}

.ec-legal li + li {
    margin-top: 0.25rem;
}

.ec-legal a {
    color: var(--ec-primary, #0b3d91);
}

@media (min-width: 64rem) {
    .ec-auth--page .ec-auth-hero {
        position: sticky;
        top: 0;
        height: 100dvh;
        min-height: 0;
    }

    .ec-auth--page .ec-auth__main {
        align-items: flex-start;
        padding: 3rem 2rem;
    }
}

/* ------------------------------------------------------------ Utilities ---- */

.ec-flex { display: flex; }
.ec-flex-wrap { flex-wrap: wrap; }
.ec-items-start { align-items: flex-start; }
.ec-items-center { align-items: center; }
.ec-items-end { align-items: end; }
.ec-items-baseline { align-items: baseline; }
.ec-justify-start { justify-content: flex-start; }
.ec-justify-center { justify-content: center; }
.ec-justify-end { justify-content: flex-end; }
.ec-justify-between { justify-content: space-between; }
.ec-gap-1 { gap: 0.25rem; }
.ec-gap-2 { gap: 0.5rem; }
.ec-gap-3 { gap: 0.75rem; }
.ec-gap-4 { gap: 1rem; }
.ec-gap-6 { gap: 1.5rem; }
.ec-cursor-pointer { cursor: pointer; }

.ec-p-2 { padding: 0.5rem; }
.ec-p-3 { padding: 0.75rem; }
.ec-p-4 { padding: 1rem; }
.ec-p-6 { padding: 1.5rem; }
.ec-pt-2 { padding-top: 0.5rem; }
.ec-pt-6 { padding-top: 1.5rem; }
.ec-pb-2 { padding-bottom: 0.5rem; }

.ec-text-xs { font-size: 0.75rem; line-height: 1rem; }
.ec-text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.ec-text-base { font-size: 1rem; line-height: 1.5rem; }
.ec-text-lg { font-size: 1.125rem; line-height: 1.75rem; }

/* Tinted, dashed panel for an optional helper step inside a form section. */
.ec-callout {
    padding: 1.25rem;
    border-radius: 0.75rem;
    background-color: color-mix(in oklab, var(--primary-50) 70%, #fff);
    border: 1px dashed var(--primary-200);
}

.ec-callout__footer {
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid color-mix(in oklab, var(--primary-200) 60%, transparent);
    color: var(--gray-700);
}

.ec-mt-1 { margin-top: 0.25rem; }
.ec-mt-2 { margin-top: 0.5rem; }
.ec-mt-3 { margin-top: 0.75rem; }
.ec-mt-4 { margin-top: 1rem; }
.ec-mb-1 { margin-bottom: 0.25rem; }
.ec-mb-2 { margin-bottom: 0.5rem; }
.ec-mb-2_5 { margin-bottom: 0.625rem; }
.ec-mb-3 { margin-bottom: 0.75rem; }
.ec-mb-4 { margin-bottom: 1rem; }
.ec-mb-6 { margin-bottom: 1.5rem; }
.ec-text-end { text-align: end; }
.ec-nowrap { white-space: nowrap; }
.ec-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

/* ------------------------------------------------------------ Dashboard ---- */

.ec-dashboard {
    display: grid;
    gap: 1.5rem;
}

/* Grid items default to min-width: auto and would grow to fit a wide table inside. */
.ec-dashboard > * {
    min-width: 0;
}

@media (min-width: 80rem) {
    .ec-dashboard {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ec-dashboard__full {
        grid-column: 1 / -1;
    }

    .ec-dashboard__wide {
        grid-column: span 2;
    }
}

.ec-chart {
    position: relative;
    height: 260px;
}

/* ---------------------------------------------------------- Export page ---- */

.ec-export__formats {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ec-export__format {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.625rem;
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--gray-200);
}

.ec-export__format:has(input:checked) {
    box-shadow: 0 0 0 2px var(--primary-500);
    background: var(--primary-50);
}

.ec-export__format input {
    margin-top: 0.25rem;
    accent-color: var(--primary-600);
}

.ec-export__format .ec-icon {
    color: var(--gray-500);
}

.ec-export__columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
}

/* --------------------------------------------------------- Form layout ---- */
/* Two-thirds main column + one-third side column on large screens. */

.ec-form-layout {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

.ec-form-layout__main,
.ec-form-layout__side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

@media (min-width: 64rem) {
    .ec-form-layout {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }
}

.ec-permission-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 48rem) {
    .ec-permission-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 80rem) {
    .ec-permission-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ---------------------------------------------------------------- Phones ---- */

@media (max-width: 39.99rem) {
    /* Top bar: logo tile only, so the language switch and account menu fit. */
    .ec-topbar {
        gap: 0.5rem;
    }

    .ec-topbar__brand .ec-brand__text {
        display: none;
    }

    .ec-topbar__end {
        gap: 0.5rem;
    }

    .ec-topbar .ec-locale button {
        padding-inline: 0.625rem;
    }

    /* List toolbar: filters two per row, search and page size on a full row below. */
    .ec-table-toolbar__filter {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 0;
    }

    .ec-table-toolbar__end {
        width: 100%;
        margin-inline-start: 0;
        flex-wrap: nowrap;
    }

    .ec-table-toolbar__end .ec-table-toolbar__filter--narrow {
        flex: 0 0 5rem;
    }

    .ec-search {
        flex: 1;
        width: auto;
        align-self: flex-end;
    }

    .ec-page-header__title {
        font-size: 1.375rem;
        line-height: 1.875rem;
    }
}

/* ------------------------------------------------- Utilities & variants ---- */
/* Small helpers used by the module pages (petitions, debates, candidates, polls, shop…). */

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.ec-text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.ec-text-2xl { font-size: 1.5rem; line-height: 2rem; }
.ec-text-center { text-align: center; }
.ec-text-slate-400 { color: var(--gray-400); }
.ec-text-blue-600 { color: var(--primary-600); }
.ec-text-emerald-600 { color: var(--success-600); }
.ec-text-emerald-700 { color: var(--success-700); }
.ec-text-rose-600 { color: var(--danger-600); }
.ec-text-amber-500 { color: #f59e0b; }
.ec-text-amber-700 { color: var(--warning-700); }
.ec-text-amber-900 { color: #78350f; }
.ec-bg-slate-200 { background-color: var(--gray-200); }

.ec-block { display: block; }
.ec-ml-1 { margin-inline-start: 0.25rem; }
.ec-gap-1\.5 { gap: 0.375rem; }
.ec-w-10 { width: 2.5rem; }
.ec-h-10 { height: 2.5rem; }
.ec-rounded-full { border-radius: 9999px; }
.ec-object-cover { object-fit: cover; }
.ec-underline,
.ec-hover-underline:hover { text-decoration: underline; }

.ec-icon--md { width: 1.5rem; height: 1.5rem; }
.ec-icon--lg { width: 2rem; height: 2rem; }

.ec-avatar--lg { width: 3rem; height: 3rem; }
.ec-avatar--rounded { border-radius: 0.5rem; }

.ec-section__icon--primary { color: var(--primary-600); }
.ec-section__icon--teal { color: #0d9488; }
.ec-section__icon--orange { color: #ea580c; }

@media (min-width: 48rem) {
    .ec-form-grid--4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.ec-btn--xs {
    padding: 0.1875rem 0.5rem;
    font-size: 0.75rem;
}

.ec-btn--full { width: 100%; }

.ec-btn--icon {
    padding: 0.375rem;
    aspect-ratio: 1;
    justify-content: center;
}

.ec-btn--icon.ec-btn--sm { padding: 0.3125rem; }

.ec-btn--secondary {
    color: var(--gray-700);
    background-color: var(--gray-100);
    background-image: none;
}

.ec-btn--secondary:hover { background-color: var(--gray-200); }

.ec-btn--outline-secondary { --ec-outline: var(--gray-600); }

.ec-badge--neutral { color: var(--gray-700); background-color: var(--gray-100); }

.ec-badge--sm {
    padding: 0 0.5rem;
    font-size: 0.6875rem;
    line-height: 1.125rem;
}

.ec-badge__icon { width: 0.875rem; height: 0.875rem; }

.ec-input--sm {
    padding-block: 0.3125rem;
    font-size: 0.8125rem;
}

.ec-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-600);
}

.ec-form-error {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--danger-600);
}

.ec-table__actions-header { text-align: end; }

/* Horizontal bar: track + fill (vote shares, progress). */
.ec-bar {
    width: 100%;
    height: 0.5rem;
    overflow: hidden;
    border-radius: 9999px;
    background-color: var(--gray-200);
}

.ec-bar__fill {
    height: 100%;
    border-radius: inherit;
    background-color: var(--success-600);
}

.ec-bar__fill--primary { background-color: var(--primary-600); }
.ec-bar__fill--warning { background-color: var(--warning-600); }

/* Thumbnail in a table cell or gallery. */
.ec-thumb {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    object-fit: cover;
    background-color: var(--gray-100);
    color: var(--gray-500);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ec-thumb--lg { width: 4.5rem; height: 4.5rem; }

.ec-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.75rem;
}

.ec-gallery img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    object-fit: cover;
}

/* Repeating rows in a form (manifesto items, survey options). */
.ec-repeater { display: grid; gap: 0.75rem; }

.ec-repeater__row {
    display: grid;
    gap: 0.75rem;
    align-items: end;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background-color: var(--gray-50);
    box-shadow: inset 0 0 0 1px var(--gray-200);
}

@media (min-width: 48rem) {
    .ec-repeater__row { grid-template-columns: 10rem 1fr 1fr auto; }
    .ec-repeater__row--2 { grid-template-columns: 1fr 12rem auto; }
    .ec-repeater__row--5 { grid-template-columns: 2fr 1fr 6rem 1fr auto; }
}

/* A threaded comment / post body. */
.ec-comment {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--gray-100);
}

.ec-comment:first-child { border-top: 0; }
.ec-comment__body { flex: 1; min-width: 0; }
.ec-prose { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.6; }

/* ------------------------------------------------------------ Dropzone -- */

.ec-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 8.5rem;
    padding: 1.25rem 1rem;
    border: 2px dashed var(--gray-300);
    border-radius: 0.875rem;
    background-color: var(--gray-50);
    text-align: center;
    transition: border-color 150ms var(--ec-ease), background-color 150ms var(--ec-ease);
}

.ec-dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.ec-dropzone:hover,
.ec-dropzone--over {
    border-color: var(--primary-500);
    background-color: rgb(30 136 229 / 0.06);
}

.ec-dropzone:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(30 136 229 / 0.15);
}

.ec-dropzone--filled {
    border-style: solid;
    border-color: var(--ec-green);
    background-color: rgb(22 163 74 / 0.05);
}

.ec-field--invalid .ec-dropzone {
    border-color: var(--danger-600);
}

.ec-dropzone__icon {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--gray-400);
    pointer-events: none;
}

.ec-dropzone:hover .ec-dropzone__icon,
.ec-dropzone--over .ec-dropzone__icon {
    color: var(--primary-500);
}

.ec-dropzone__title {
    font-size: 0.875rem;
    color: var(--gray-600);
    pointer-events: none;
}

.ec-dropzone__browse {
    font-weight: 600;
    color: var(--primary-600);
}

.ec-dropzone__hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    pointer-events: none;
}

.ec-dropzone__file {
    max-width: 100%;
    margin-top: 0.25rem;
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ec-green);
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}
