/*

Colors

*/

:root {
    /* Defaults:
        - The 500 suffix (except for text color)
    */

    --color-primary-500-a1: rgba(0, 162, 184, 0.1);
    --color-primary-500-a2: rgba(0, 162, 184, 0.2);
    --color-primary-500-a4: rgba(0, 162, 184, 0.4);
    --color-primary-500: rgba(0, 162, 184);
    --color-primary-600: rgb(0, 151, 171);
    --color-primary-700: rgb(1, 119, 134);
    --color-primary-900: rgb(0, 78, 88);

    --color-secondary-500: #00C6A7;

    --color-accent-500: #FFA700;
    --color-accent-700: #F88312;
    /*
    --color-primary-50: rgb(171, 234, 243);
    --color-primary-100: rgb(99, 207, 221);
    --color-primary-200: rgb(67, 192, 208);
    --color-primary-300: rgb(41, 180, 198);
    --color-primary-400: #1eb2c6;
    --color-primary-500-a1: #00A2B81A;
    --color-primary-500-a2: #00A2B833;
    --color-primary-500-a4: rgba(0, 162, 184, 0.4);
    --color-primary-500: #00A2B8;
    --color-primary-600: #0097ab;
    --color-primary-700: #017786;
    --color-primary-800: #00616e;
    --color-primary-900: #004E58;

    --color-secondary-50: #fce4ec;
    --color-secondary-100: #f8bbd0;
    --color-secondary-200: #f48fb1;
    --color-secondary-300: #f06292;
    --color-secondary-400: #ec407a;
    --color-secondary-500: #e91e63;
    --color-secondary-600: #d81b60;
    --color-secondary-700: #c2185b;
    --color-secondary-800: #ad1457;
    --color-secondary-900: #880e4f;

    --color-accent-500: #FFA700;
    --color-accent-700: #F88312;

    --color-text-primary: var(--color-primary-500);
    --color-text-secondary: var(--color-secondary-500);
    --color-text-muted: var(--color-secondary-500);

    --color-light-text-on-dark: #FFFFFF;
    --color-dark-text-on-light: #71748D;


    --color-success: #4caf50;
    --color-success-light: #81c784;
    --color-success-dark: #388e3c;

    --color-error: #f44336;
    --color-error-light: #e57373;
    --color-error-dark: #d32f2f;

    --color-warning: #ff9800;
    --color-warning-light: #ffb74d;
    --color-warning-dark: #f57c00;

    --color-info: #2196f3;
    --color-info-light: #64b5f6;
    --color-info-dark: #1976d2;

    --color-shadow-light: rgba(0, 0, 0, 0.1);
    --color-shadow-default: rgba(0, 0, 0, 0.2);
    --color-shadow-dark: rgba(0, 0, 0, 0.4);
*/


    --color-gray-50: #F9FAFB;
    --color-gray-100: #F3F4F6;
    --color-gray-200: #E5E7EB;
    --color-gray-300: #D1D5DB;
    --color-gray-400: #9a9db7;
    --color-gray-500: #71748D;
    --color-gray-600: #4B5563;
    --color-gray-700: #374151;
    --color-gray-800: #1F2937;

    --color-success: #10B981;
    --color-success-muted: #ECFDF5;
    --color-info: #93C5FD;
    --color-info-muted: #EFF6FF;
    --color-warning: #F59E0B;
    --color-warning-muted: #FFFBEB;
    --color-danger: #DC2626;
    --color-danger-muted: #FEF2F2;

    --color-gray-bg: var(--color-gray-50);
    --color-fallback-gray-text: #1F2937;




    --color-text-primary: var(--color-gray-700);
    --color-text-secondary: var(--color-gray-500);
    --color-text-muted: var(--color-gray-400);
    --color-text-muted-more: var(--color-gray-300);

    /* TODO: better name */
    --color-text-action-inverse: #FFFFFF;
    --color-link-hover: var(--color-primary-600);


    --color-shadow-primary: var(--color-primary-500-a4);
    --color-shadow-neutral: rgba(0, 0, 0, 0.1);
    --color-separator: var(--color-gray-200);
    /* --color-separator: #E6E6F2; */

}

/* end of colors */

/*

Typography

*/

:root {
    /* Defaults:
        - Size: md
        - 
    */

    --font-size-xxs: 12px;
    --font-size-xs: 14px;
    --font-size-sm: 16px;
    --font-size-md: 18px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;

    --font-family-base: system-ui, -apple-system, sans-serif;
}

/* end of colors */

/*

Spacing

*/

:root {
    /* Defaults:
        - Padding: md
    */

    --spacing-xxs: 4px;
    --spacing-xs: 6px;
    --spacing-sm: 8px;
    --spacing-sm-plus: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxxl: 64px;
}

/* end of colors */

/*

Border

*/

:root {
    /* Defaults:
        - Radius: md
    */

    --border-radius-sm: 4px;
    --border-radius-md: 8px;

    --border-xxxs: 1px solid var(--color-gray-200);
    --border-separator: 1px solid var(--color-separator);
    --border-input: 1px solid var(--color-gray-300);
    --border-table: 1px solid var(--color-gray-200);
}

/* end of colors */

/*

Shadow

*/

:root {
    /* Defaults:
        - md
        - 
    */

    --shadow-sm: 0 1px 3px var(--color-shadow-primary);
    --shadow-md: 0 4px 6px var(--color-shadow-primary);

    --shadow-input-md: 0 0 0 3px var(--color-primary-500-a2);
    --shadow-neutral-md: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-neutral-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* end of colors */

/*

Animation

*/

:root {
    --animation-sm: 0.2s;
    --animation-md: 0.3s;
    --animation-lg: 0.5s;
    --animation-xxxl: 5s;

    --animation-slide-down: slideDown var(--animation-md) ease-out;
    --animation-slide-up: slideUp var(--animation-md) ease-in forwards;
    --animation-transition: all var(--animation-md);
}

/* end of colors */

/*

Misc

*/

:root {}

/* end of colors */
/* For me, 1rem ~16px */
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background: var(--color-gray-bg);
    color: var(--color-text-primary);
    line-height: 1.5;
}
/* Admin app shell */
.app-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-template-rows: 60px 1fr;
    min-height: 100vh;
}

/* Header bar */
.header-bar {
    grid-column: 1 / -1;
    background: white;
    border-bottom: var(--border-separator);
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    width: 100%;
    height: 60px;
    z-index: 100;

    box-shadow: var(--shadow-sm);
}

.header-bar-start {
    display: flex;
    align-items: center;
}

.company-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 500;
    margin-left: var(--spacing-sm);
}

.header-bar-end {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 0;
}

/* Profile dropdown */
.profile-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    min-width: 0;
}

.profile-info {
    text-align: right;
    margin-right: var(--spacing-sm);
    line-height: 1.35;
    min-width: 0;
}

.profile-info .label {
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
}

.profile-info .value {
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-image {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: var(--border-xxxs);
    background: var(--color-gray-200);
    flex-shrink: 0;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-neutral-lg);
    border: var(--border-separator);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--animation-sm) ease-in-out;
}

.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-header {
    padding: var(--spacing-md);
    border-bottom: var(--border-separator);
}

.profile-dropdown-name {
    font-weight: 500;
    color: var(--color-text-primary);
}

.profile-dropdown-role {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.profile-dropdown-menu {
    padding: var(--spacing-sm) 0;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm-plus) var(--spacing-md);
    color: var(--color-text-primary);
    text-decoration: none;
    gap: var(--spacing-sm-plus);
}

.profile-dropdown-item:hover {
    background: var(--color-gray-100);
}

.profile-dropdown-item.danger {
    color: var(--color-danger);
}

.profile-dropdown-item.danger:hover {
    background: var(--color-danger-muted);
}

.profile-dropdown-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Sidebar navigation */
.sidebar {
    background: white;
    border-right: var(--border-separator);
    padding: var(--spacing-md);
    position: fixed;
    top: 60px;
    bottom: 0;
    width: 250px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm-plus);
    padding: var(--spacing-sm-plus) var(--spacing-md);
    color: var(--color-gray-600);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-xxs);
}

.nav-item:hover {
    background: var(--color-gray-100);
    color: var(--color-text-primary);
}

.nav-item.active {
    background: var(--color-primary-500);
    color: var(--color-text-action-inverse);
}

/* Hamburger menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: var(--spacing-md);
}

.menu-toggle span {
    width: 100%;
    height: 2px;
    background: var(--color-gray-800);
    transition: all var(--animation-md) linear;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Main content area */
.main-content {
    display: grid;
    grid-column: 2;
    padding: var(--spacing-xl);
    margin-top: 60px;
    /* Grid items default to min-width:auto, so without this a wide table or a long unbroken URL
       stretches the column past the viewport and the whole page scrolls sideways. */
    min-width: 0;
}

.main-content > * {
    min-width: 0;
}

.main-content::after {
    content: ' ';
    padding: var(--spacing-md);
}

/* Metric cards */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    padding: 1.5rem;
}

.metric-value {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--color-gray-800);
}

.metric-label {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .menu-toggle {
        display: flex;
    }

    .sidebar {
        display: block;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 100;
        /* On a small phone a fixed 250px drawer leaves almost nothing of the page showing behind
           it, which is what tells you the drawer is a temporary overlay. */
        width: min(250px, 80vw);
    }

    .main-content {
        grid-column: 1;
        padding: var(--spacing-md);
    }

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

    .header-bar {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .header-bar-start {
        min-width: 0;
    }

    /* The hamburger and the institution name already say where you are, so the logo is the first
       thing to give up its share of a narrow bar. */
    .company-selector img {
        display: none;
    }

    .company-selector {
        min-width: 0;
        margin-left: 0;
    }

    .header-bar-end {
        gap: var(--spacing-sm-plus);
        font-size: var(--font-size-xs);
    }

    /* The dropdown header repeats who is signed in, so on a narrow bar the caption above the
       institution name is the part that goes; the name itself stays, since it's the only place
       the selected institution is shown. */
    .profile-info .label {
        display: none;
    }

    .profile-info {
        margin-right: 0;
    }
}

.alert-banner-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
    max-width: 400px;
    /* max-width: 100%; */
    pointer-events: none;
}

/* Alert Banner Styles */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    /* background: rgb(17, 152, 89); */
    box-shadow: var(--shadow-neutral-md);
    pointer-events: auto;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
    animation: var(--animation-slide-down)
}

.alert-banner.removing {
    animation: var(--animation-slide-up)
}

/*
Banner Types
*/


.alert-banner-success {
    background: var(--color-success-muted);
    border: 1px solid var(--color-success);
}

.alert-banner-info {
    background: var(--color-info-muted);
    border: 1px solid var(--color-info);
}

.alert-banner-warning {
    background: var(--color-warning-muted);
    border: 1px solid var(--color-warning);
}

.alert-banner-error {
    background: var(--color-danger-muted);
    border: 1px solid var(--color-danger);
}


.alert-banner-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.alert-banner-content {
    flex-grow: 1;
}

.alert-banner-title {
    font-weight: 500;
    color: var(--color-gray-800);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-banner-message {
    color: var(--color-gray-600);
    font-size: 14px;
}

.alert-banner-actions {
    margin-top: 12px;
    display: flex;
    gap: 12px;
}

.alert-banner-button {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--animation-transition);
}

.alert-banner-button-primary {
    background: var(--color-primary);
    /* background-color: red;; */
    color: white;
    border: none;
}

.alert-banner-button-secondary {
    background: transparent;
    border: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
}

.alert-banner-close {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-gray-300);
}

.alert-banner-close:hover {
    color: var(--color-gray-600);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}
/* Form Components */

/* Lists with action, allowing for spinner */
.action-list {
    overflow: hidden;
    padding-bottom: var(--spacing-sm);
}

.action-list a {
    text-decoration: none;
}

.action-list > li:first-child {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.action-list > a:first-of-type li {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.action-list > a:last-of-type li {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.action-list-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-height: 32px;

    padding: var(--spacing-md);
    border-collapse: separate;
    margin-bottom: -1px;
    text-decoration: none;
    border: var(--border-separator);
}

.action-list-item:hover {
    color: var(--color-text-primary);
    text-decoration: none;
    background-color: var(--color-gray-100);
}

.action-list-item .text {
    flex: 1;
    min-width: 0;
    padding-right: var(--spacing-sm);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.action-list-item .spinner-wrapper {
    flex-shrink: 0;
    align-self: center;
}

.action-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    color: var(--color-text-primary);
}
.answer-set-fieldset {
    border: none;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.answer-set-fieldset:disabled {
    opacity: 0.6;
}

.answer-set-list {
    display: flex;
    flex-direction: column;
    margin-top: var(--spacing-md);
}

.answer-set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-sm-plus) 0;
    border-bottom: var(--border-separator);
    text-decoration: none;
}

.answer-set-row:last-child {
    border-bottom: none;
}

.answer-set-row-main {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
    min-width: 0;
}

.answer-set-row-label {
    font-weight: 600;
    color: var(--color-text-primary);
}

.answer-set-row-options {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.answer-set-row-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.answer-set-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.answer-set-option-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto auto;
    grid-template-areas: "order position label scorable weight remove";
    align-items: center;
    gap: var(--spacing-sm);
}

.answer-set-option-order {
    grid-area: order;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* The position doubles as the auto-assigned weight, so it reads as the score the option carries. */
.answer-set-option-position {
    grid-area: position;
    min-width: 24px;
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.answer-set-option-label {
    grid-area: label;
}

.answer-set-option-remove {
    grid-area: remove;
}

.answer-set-option-scorable,
.answer-set-advanced-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-xxs);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.answer-set-option-scorable {
    grid-area: scorable;
}

.answer-set-option-weight {
    grid-area: weight;
    max-width: 90px;
}

@media (max-width: 720px) {
    /* Six controls in one line don't fit a phone, so the label gets a line of its own and the
       reorder buttons span both rows next to it, since they belong to the option, not a line. */
    .answer-set-option-row {
        grid-template-columns: auto auto 1fr auto;
        grid-template-areas:
            "order position label    remove"
            "order position scorable weight";
    }

    .answer-set-option-weight {
        justify-self: end;
    }
}

@media (max-width: 640px) {
    .answer-set-row {
        flex-wrap: wrap;
    }
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xxs) var(--spacing-sm-plus);
    border-radius: 9999px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.status-active {
    background: var(--color-warning-muted);
    color: var(--color-warning);
}

.status-pending {
    background: var(--color-gray-100);
    color: var(--color-gray-600);
}

.status-error {
    background: var(--color-danger-muted);
    color: var(--color-danger);
}

.status-completed {
    background: var(--color-success-muted);
    color: var(--color-success);
}
.breadcrumb {
    display: flex;
    list-style: none;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-xs);
    background-color: transparent;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li + li::before {
    content: ">";
    font-size: var(--font-size-xs);
    margin: 0 var(--spacing-sm);
    color: var(--color-text-muted);
}

.breadcrumb li a {
    text-decoration: none;
    color: var(--color-primary-500);
    transition: color var(--animation-md) ease;
}

.breadcrumb li a:hover {
    color: var(--color-link-hover);
}

.breadcrumb li:last-child a {
    color: var(--color-text-muted);
    pointer-events: none;
    cursor: default;
}

/* Mobile Responsive - Hide older breadcrumb items */
@media screen and (max-width: 767px) {
    .breadcrumb li {
        margin-right: var(--spacing-xxs);
    }

    .breadcrumb li:nth-last-child(n+3) {
        display: none;
        /* Hide older breadcrumb items */
    }

    /* show ... for older breadcumb items */
    .breadcrumb::before {
        content: "...";
        color: var(--color-text-muted);
    }

    /* hide ... in case there are few items in breadcrumb */
    .breadcrumb:not(:has(li:nth-last-child(n+3)))::before {
        display: none;
    }
}
/* Form Components */

a {
    color: var(--color-text-primary);
}

.click-buffer {
    padding: var(--spacing-sm);
}

a:hover {
    color: var(--color-link-hover);
}

.button {
    position: relative;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm-plus) var(--spacing-lg);
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: var(--font-size-md);
    text-decoration: none;
}

.button-with-spinner {
    padding: var(--spacing-sm-plus) var(--spacing-xxxl);
}

.button .spinner-wrapper {
    position: absolute;
    right: var(--right-button-spinner);
    top: 0;
    bottom: 0;
    margin: auto;
}

.button-primary {
    background: var(--color-primary-500);
    color: var(--color-text-action-inverse);
}

.button-primary:hover {
    background: var(--color-primary-600);
    color: var(--color-text-action-inverse);
}

.button-primary:active {
    background: var(--color-primary-900);
}

.button-inverse {
    background: white;
    color: var(--color-primary-500);
}

.button-inverse:hover {
    background: rgb(231, 231, 231);
    color: var(--color-primary-500);
}

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

.button-danger:hover {
    background: var(--color-danger-muted);
    color: var(--color-danger);
}

/* Square, single-glyph button for row controls (reorder, remove). */
.button-icon {
    padding: var(--spacing-xxs) var(--spacing-sm);
    line-height: 1;
}

@media (max-width: 480px) {
    .button {
        padding: var(--spacing-sm-plus) var(--spacing-md);
        font-size: var(--font-size-sm);
    }

    /* Still leaves room for the spinner on the right, without the button taking the whole line
       just to hold its own padding. */
    .button-with-spinner {
        padding: var(--spacing-sm-plus) var(--spacing-xl);
    }
}
.card {
    padding: var(--spacing-xl);
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* The title keeps the first line and the actions drop below it once they stop fitting side by
       side, which is what happens to almost every header on a phone. */
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.card-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.card-collapsable .card-header {
    cursor: pointer;
    user-select: none;
}

.card-content {
    overflow: hidden;
    transition: height 0.3s ease-out;
}

.card-content.collapsed {
    height: 0 !important;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
    transform: rotate(-180deg);
}

@media (max-width: 768px) {
    /* 32px of padding on each side is a sixth of a phone's width, and the content needs it. */
    .card {
        padding: var(--spacing-md);
    }
}
/* Styled from the element and not from a class: every checkbox in the admin sits bare inside a
   label, so a class would have to be added to each one to reach the same place. */
input[type="checkbox"] {
    appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: var(--border-input);
    border-radius: var(--border-radius-sm);
    background-color: white;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 14px;
    cursor: pointer;
    transition: var(--animation-transition);
}

input[type="checkbox"]:hover:not(:disabled) {
    border-color: var(--color-primary-500);
}

input[type="checkbox"]:checked,
input[type="checkbox"]:indeterminate {
    border-color: var(--color-primary-500);
    background-color: var(--color-primary-500);
}

input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5'/%3E%3C/svg%3E");
}

input[type="checkbox"]:indeterminate {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M4 8h8'/%3E%3C/svg%3E");
}

input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: var(--shadow-input-md);
}

input[type="checkbox"]:disabled {
    border-color: var(--color-gray-200);
    background-color: var(--color-gray-100);
    cursor: not-allowed;
}

input[type="checkbox"]:disabled:checked,
input[type="checkbox"]:disabled:indeterminate {
    border-color: var(--color-gray-300);
    background-color: var(--color-gray-300);
}

.date-picker-container {
    position: relative;
    width: 100%;
    padding: 0;
}

.date-input {
    cursor: pointer;
}

.calendar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    /* Never wider than the field it drops out of, so it can't hang off the edge of a phone. */
    width: min(300px, 100%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    z-index: 1000;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.calendar-header button {
    background: none;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 16px;
}

.calendar-header button:hover {
    background: #e9ecef;
    border-radius: 4px;
}

.calendar-header button:disabled {
    cursor: not-allowed;
    color: #ccc;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 10px;
}

.weekday {
    text-align: center;
    font-weight: bold;
    padding: 5px;
    font-size: 14px;
    color: #666;
}

.date-cell {
    text-align: center;
    padding: 8px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    /* Seven cells across a phone leaves each one narrow, so height carries the touch target. */
    min-height: 40px;
}

.date-cell:hover:not(:disabled) {
    background: #f0f0f0;
    border-radius: 4px;
}

.date-cell.selected {
    background: #007bff;
    color: white;
    border-radius: 4px;
}

.date-cell.today {
    border: 1px solid #007bff;
    border-radius: 4px;
}

.date-cell:disabled {
    color: #ccc;
    cursor: not-allowed;
    text-decoration: line-through;
}

.date-cell:disabled:hover {
    background: none;
}

.date-picker-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-picker-clear-button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #666;
    display: none;
    /* Hidden by default */
}

.date-picker-clear-button:hover {
    color: #dc3545;
}

/* Show clear button when input has value */
.date-input:not([value=""])~.date-picker-clear-button {
    display: block;
}

/* Adjust input padding to accommodate clear button */
.date-input {
    padding-right: 32px;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xl) var(--spacing-md);
    text-align: center;
}

.empty-state-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-text-primary);
}

.empty-state-hint {
    max-width: 52ch;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.form-group {
    margin-top: var(--spacing-lg);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--spacing-lg);
}

/* 350px is the width at which two fields stop being worth putting side by side, so it is the
   basis and not a hard minimum. As a `min-width` it refused to shrink below 350px once the row
   had wrapped, which overflowed every phone narrower than that. */
.form-row .form-group {
    flex: 1 1 350px;
    min-width: 0;
}
.w100 {
    width: 100%;
}

.mt-md {
    margin-top: var(--spacing-md) !important;
}

.mt-lg {
    margin-top: var(--spacing-lg) !important;
}

.mb-md {
    margin-bottom: var(--spacing-md) !important;
}

.muted {
    color: var(--color-text-muted) !important;
}

.fade-out {
    animation: fade 1s;
}

@keyframes fade {
    from {
        opacity: 1
    }

    to {
        opacity: 0
    }
}


.htmx-swapping {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.external-right {
    float: right;
}
.h1 {
    color: var(--color-text-primary);
    font-size: var(--font-size-xl);
    margin: var(--spacing-md);
    text-align: center;
    font-weight: 600;
}

.h2 {
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    margin: var(--spacing-md);
    text-align: center;
    font-weight: 600;
}

.h3 {
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    margin: var(--spacing-md);
    text-align: center;
    font-weight: 600;
}

.h4 {
    color: var(--color-text-primary);
    font-size: var(--font-size-md);
    margin: var(--spacing-md);
    text-align: center;
}

.heading-lighter {
    color: var(--color-text-secondary)
}

@media (max-width: 768px) {
    /* The side margin doubles up with the card's own padding, which is too much to give away once
       the card is only as wide as a phone. */
    .h1,
    .h2,
    .h3,
    .h4 {
        margin: var(--spacing-sm) 0;
    }
}
.label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    margin-left: var(--spacing-xxs);
}


::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
    /* Firefox */
}

.input {
    width: 100%;
    padding: var(--spacing-md);
    border: var(--border-input);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    color: var(--color-text-primary);
}

.input:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: var(--shadow-input-md);
}


/* Form Validation States */
.input-error {
    border-color: var(--color-danger);
}

.error-message {
    color: var(--color-danger);
    font-size: var(--font-size-sm);
    margin: var(--spacing-xxs);
}

/* By setting the error message as hx-indicator as well,
this will ensure it's hidden when the request is performed again
Use case:
    invalidd form -> user fix input -> sends request again -> hide error
*/
.error-message.htmx-request {
    opacity: 0;
}

.hint-message {
    color: var(--color-gray-600);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xxs);
}

.warning-message {
    color: var(--color-warning);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xxs);
}

.textarea {
    font-family: var(--font-family-base);
    resize: vertical;
}
.list {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
}

.list-header {
    background-color: var(--color-gray-300);
    padding: 1rem;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: center;
}

.list-header-item {
    width: 100%;
}

.list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Label and value sit on one line while they fit and stack when they don't, which on a phone
       is most rows carrying a long value. */
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.list-item:last-child {
    border-bottom: none;
}

/* Sized from its basis and not from its content: the block's max-content width is the whole
   URL on one unbroken line, and a wrapping flex line breaks on that hypothetical size, so the
   block never fit beside "Link de resposta" and pushed it onto a row of its own. A 20rem basis
   keeps the two side by side on the card and stacks them only when the screen really is too
   narrow for both. */
.questionnaire-response-link {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    flex: 1 1 20rem;
    max-width: 100%;
    min-width: 0;
}

/* The URL is truncated to whatever room it has, not to a fixed width, so it fits
   a phone as well as the card.
   `min-width: 0` is what makes the ellipsis work at all: a nowrap line is its own min-content
   size, so without this the span refuses to shrink as a flex item and simply overflows.
   The 16rem basis is the width below which the URL takes a line of its own and the buttons drop
   underneath it, instead of every one of them sharing a line too narrow to read. */
.questionnaire-response-link-url {
    flex: 1 1 16rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    color: var(--color-text-secondary);
}
:root {
    --margin-form-group-t: 12px;

    --right-button-spinner: 24px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mt-lg {
    margin-top: var(--spacing-lg);
}


:root {
    --padding-input: 12px;

    --padding-button-small: 12px 24px;
}

.question-flags {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: var(--border-separator);
}

.question-flag {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.question-flag input {
    margin-top: 3px;
    flex-shrink: 0;
}

.question-flag > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.question-flag strong {
    font-size: var(--font-size-xs);
    color: var(--color-text-primary);
}

.question-score-weight {
    max-width: 120px;
}

/* Tabs (questionnaire detail: "Minhas Seções" / "Classificação") */

.tab-bar {
    display: flex;
    gap: var(--spacing-xxs);
    background: var(--color-gray-100);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-xxs);
}

.tab-bar-item {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.tab-bar-item:hover {
    color: var(--color-text-primary);
    background: var(--color-gray-200);
}

.tab-bar-item-active,
.tab-bar-item-active:hover {
    color: var(--color-primary-700);
    background: white;
    box-shadow: var(--shadow-sm);
}

/* Section tree (drag-and-drop grouping/reordering) */

.section-tree-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.section-tree-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.section-node {
    border: var(--border-xxxs);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
}

.section-node-ungrouped {
    border-style: dashed;
}

.section-node-sub {
    padding: var(--spacing-sm-plus);
}

.section-node-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.section-node-label {
    font-weight: 500;
    flex: 1;
}

.section-node-label-muted {
    color: var(--color-text-muted);
    font-style: italic;
}

.section-node-subsections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.section-questions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
    min-height: 8px;
}

.section-question-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border: var(--border-xxxs);
    border-radius: var(--border-radius-md);
    background: white;
    text-decoration: none;
    color: inherit;
}

.section-question-row:hover {
    background: var(--color-gray-50);
}

.section-question-label {
    flex: 1;
}

.section-question-tags {
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
}

/* The padding is the touch target: the glyph on its own is a few pixels wide, and `touch-action`
   stops the page from scrolling out from under a drag that started on the handle. */
.drag-handle {
    cursor: grab;
    color: var(--color-text-muted);
    padding: var(--spacing-sm) var(--spacing-xxs);
    touch-action: none;
}

.sortable-ghost {
    opacity: 0.4;
}

.sortable-chosen {
    box-shadow: var(--shadow-sm);
}

#save-section-order:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    /* Two tabs sharing the width beats one of them wrapping onto its own line. */
    .tab-bar-item {
        flex: 1;
        text-align: center;
        padding: var(--spacing-sm) var(--spacing-sm-plus);
        font-size: var(--font-size-xs);
    }

    .section-tree-toolbar .button {
        flex: 1;
    }

    /* Each level of nesting spends width twice, its own padding plus the parent's, so both get
       cut down before the questions become unreadable. */
    .section-node {
        padding: var(--spacing-sm-plus);
    }

    .section-node-sub {
        padding: var(--spacing-sm);
    }

    .section-question-row {
        flex-wrap: wrap;
    }

    /* The dimension drops below the question it belongs to instead of squeezing it. */
    .section-question-tags {
        flex-basis: 100%;
    }
}

.report-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.report-stat {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
    padding: var(--spacing-sm-plus) var(--spacing-md);
    background: var(--color-gray-50);
    border: var(--border-xxxs);
    border-radius: var(--border-radius-md);
}

.report-stat-highlight {
    background: var(--color-primary-500-a1);
    border-color: var(--color-primary-500-a4);
}

.report-stat-value {
    font-size: var(--font-size-xl);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-text-primary);
}

.report-stat-highlight .report-stat-value {
    color: var(--color-primary-700);
}

.report-stat-label {
    font-size: var(--font-size-xxs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.report-stat .bar-track {
    margin-top: var(--spacing-xxs);
}

/* min() so the track can fall below 320px on a narrow screen. A bare minmax(320px, 1fr) keeps
   the column 320px wide even when the container is smaller, and pushes the page sideways. */
.report-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: var(--spacing-lg);
}

/* Chart.js reads its size from the parent, so the canvas gets a positioned box with a height of
   its own instead of a height attribute the library overwrites on the first resize. */
.report-chart-canvas {
    position: relative;
    height: 320px;
    margin-top: var(--spacing-sm);
}

/* A dimensão's label is a sentence and Chart.js draws a tick that doesn't fit past the edge of
   the canvas, so the chart carrying one label per row takes the whole grid, and the radar next
   to it comes along: half a row of empty card beside a full-width chart reads as a mistake. */
.report-chart-grid:has(.report-chart-wide) {
    grid-template-columns: 1fr;
}

.report-chart-wide .report-chart-canvas {
    height: 440px;
}

.report-note {
    display: block;
    margin-bottom: var(--spacing-md);
}

.report-score-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm-plus);
}

.report-score-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
    padding-bottom: var(--spacing-sm-plus);
    border-bottom: var(--border-separator);
}

.report-score-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.report-score-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.report-score-label {
    font-weight: 600;
    color: var(--color-text-primary);
}

.report-score-value {
    font-weight: 600;
    color: var(--color-primary-700);
    white-space: nowrap;
}

.report-score-scale {
    font-weight: 400;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.report-score-meta {
    font-size: var(--font-size-xxs);
    color: var(--color-text-secondary);
}

.report-question-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.report-question {
    padding-bottom: var(--spacing-md);
    border-bottom: var(--border-separator);
}

.report-question:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.report-question-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.report-question-label {
    font-weight: 600;
    color: var(--color-text-primary);
}

.report-question-score {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: var(--spacing-xxs) var(--spacing-sm-plus);
    border-radius: 9999px;
    background: var(--color-primary-500-a1);
    font-weight: 600;
    color: var(--color-primary-700);
    white-space: nowrap;
}

.report-question-score-scale {
    font-size: var(--font-size-xxs);
    font-weight: 400;
    color: var(--color-text-secondary);
}

.report-question-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.report-option-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
}

.report-option-row {
    display: grid;
    grid-template-columns: minmax(120px, 200px) 1fr auto;
    grid-template-areas: "label bar value";
    align-items: center;
    gap: var(--spacing-sm);
}

.report-option-label {
    grid-area: label;
}

.report-option-row .bar-track {
    grid-area: bar;
}

.report-option-value {
    grid-area: value;
}

.report-option-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.report-option-value {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.bar-track {
    background: var(--color-gray-100);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}

.bar-fill {
    background: var(--color-primary-500);
    height: 100%;
    border-radius: 9999px;
    transition: width var(--animation-lg) ease-out;
}

/* Options that carry no score still show their share of the answers, just visibly set apart
   from the ones that fed the average. */
.bar-fill-muted {
    background: var(--color-gray-300);
}

.report-option-badge {
    font-size: 11px;
    color: var(--color-text-muted);
    border: var(--border-xxxs);
    border-radius: var(--border-radius-md);
    padding: 0 var(--spacing-xxs);
    margin-left: var(--spacing-xxs);
    white-space: nowrap;
}

.report-question-optout {
    display: block;
    color: var(--color-warning);
}

.report-open-question {
    padding: var(--spacing-md) 0;
    border-bottom: var(--border-separator);
}

.report-open-question:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.report-open-answers {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.report-open-answer {
    margin: 0;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-gray-50);
    border-left: 3px solid var(--color-primary-500);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-xs);
    color: var(--color-text-primary);
}

/* The filter bar keeps its controls on one row for as long as they fit and wraps the overflow, so
   a narrow window loses the row and keeps the controls. */
.report-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--spacing-sm);
}

.report-filter-bar .form-group {
    flex: 1 1 180px;
    margin-bottom: 0;
}

/* The search box earns more room than the selects: it holds free text, they hold short labels. */
.report-filter-bar .report-filter-search {
    flex: 2 1 240px;
}

/* The profile checkboxes take the full width under the selects: there can be several questions
   with several options each, and they don't fit the single row the rest of the bar lives on.
   Collapsed by default so the bar stays a bar, and open whenever it holds a selection. */
.report-filter-profile {
    flex: 1 1 100%;
    margin-top: var(--spacing-sm);
    border: var(--border-xxxs);
    border-radius: var(--border-radius-md);
}

.report-filter-summary {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm-plus) var(--spacing-md);
    font-weight: 500;
    color: var(--color-text-primary);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.report-filter-summary::-webkit-details-marker {
    display: none;
}

.report-filter-summary:hover {
    color: var(--color-primary-600);
}

.report-filter-count {
    padding: var(--spacing-xxs) var(--spacing-sm-plus);
    border-radius: 9999px;
    background: var(--color-primary-500-a1);
    font-size: var(--font-size-xxs);
    font-weight: 500;
    color: var(--color-primary-700);
}

.report-filter-summary-caret {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform var(--animation-sm);
}

.report-filter-profile[open] .report-filter-summary-caret {
    transform: rotate(90deg);
}

.report-filter-body {
    padding: 0 var(--spacing-md) var(--spacing-md);
    border-top: var(--border-separator);
}

.report-filter-body .text-muted {
    display: block;
    margin: var(--spacing-sm-plus) 0;
}

.report-filter-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.report-filter-profile-question {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
}

.report-filter-profile-label {
    margin-bottom: var(--spacing-xxs);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-primary);
}

.report-filter-profile-choice {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-xxs) var(--spacing-xs);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    cursor: pointer;
}

.report-filter-profile-choice input {
    margin-top: 2px;
}

.report-filter-profile-choice:hover {
    background: var(--color-gray-50);
}

.report-filter-profile-choice:has(input:checked) {
    color: var(--color-primary-700);
    font-weight: 500;
}

/* The classification checkboxes sit in the same full-width block the profile ones do, one column
   per group so a dimensão reads as sitting under its eixo. */
.report-filter-tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.report-filter-tag-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
}

.report-filter-tag-parent {
    font-weight: 600;
}

.report-filter-tag-group .report-filter-profile-choice:not(.report-filter-tag-parent) {
    margin-left: var(--spacing-sm-plus);
    border-left: var(--border-separator);
}

/* Full width with a rule above it: once a filter block is on the form the buttons already sat on
   a line of their own, and the rule says the line is the end of the form rather than a gap. */
.report-filter-actions {
    display: flex;
    flex: 1 1 100%;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-md);
    border-top: var(--border-separator);
}

@media (max-width: 640px) {
    /* An option label and its bar can't share a phone's width and both stay readable, so the label
       takes the first line and the bar with its count goes underneath. */
    .report-option-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "label label"
            "bar   value";
        gap: var(--spacing-xxs) var(--spacing-sm);
    }

    .report-option-list {
        gap: var(--spacing-sm);
    }

    .report-filter-actions .button {
        flex: 1 1 auto;
    }
}

 .select {
    width: 100%;
    padding: var(--spacing-md) ;
    border: var(--border-input);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    color: var(--color-text-primary);
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: var(--shadow-input-md);
}

.select-placeholder {
    /* color: var(--color-text-muted); */
    color: red;
} 
/* Spinner container */
.spinner-wrapper {
    display: flex;
    width: 16px;
    height: 16px;
    margin-left: 8px;
}

/* Actual spinner */
.spinner {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    /* border: 2px solid #86868624; this adds a shade circle */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-light .spinner {
    border-top: 2px solid white;
    border-bottom: 2px solid white;
}

.spinner-dark .spinner {
    border-top: 2px solid black;
    border-bottom: 2px solid black;
}

.spinner-text-primary .spinner {
    border-top: 2px solid var(--color-text-primary);
    border-bottom: 2px solid var(--color-text-primary);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
.table-list {
    background: white;
    border-radius: var(--border-radius-md);
    border: var(--border-table);
    overflow: hidden;

    display: grid;
    --table-list-colum-count: 1;
    grid-template-columns: repeat(var(--table-list-colum-count), minmax(0, 1fr));
}

/* This will make the last column as short as possible */
.table-list-with-action {
    grid-template-columns: repeat(calc(var(--table-list-colum-count) - 1), minmax(0, 1fr)) auto;
}

.table-list-header {
    background: var(--color-gray-100);
    border-bottom: var(--border-table);
    padding: var(--spacing-md) 0;
    text-align: center;
}

/* TODO: with this, maybe data-id is no longer necessary (?) */
.table-list-row {
    /* this will make the grid look as the children of this element as the grid content */
    display: contents;
}

.table-list-body {
    text-align: center;
    gap: var(--spacing-md);
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: var(--border-table);
}

.table-list:last-child {
    border-bottom: none;
}

.table-list-header {
    font-weight: 500;
    color: var(--color-gray-600);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


.table-list-row:hover .table-list-body {
    background: var(--color-gray-50);
}

/* Actions */
.row-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.action-button,
.action-spinner {
    padding: var(--spacing-sm);
    border: none;
    background: transparent;
    color: var(--color-gray-600);
    cursor: pointer;
    border-radius: var(--border-radius-md);
    pointer-events: all;
}

.action-spinner {
    cursor: auto;
}

.action-button-muted {
    cursor: auto;
    color: var(--color-text-muted);
}

.action-button:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-800);
}

.action-button-muted:hover {
    background: transparent;
    color: var(--color-text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .table-list {
        grid-template-columns: 1fr;
    }

    .table-list-header {
        display: none;
        /* Hide headers on mobile */
    }

    /* The cells stop being columns of one shared grid and become the stacked contents of a single
       row, so the row itself has to draw the line that separates it from the next one. */
    .table-list-row {
        display: block;
        border-bottom: var(--border-table);
    }

    .table-list-row:last-child {
        border-bottom: none;
    }

    .table-list-body {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm) var(--spacing-md);

        text-align: right;
        border: none;
    }

    .table-list-body::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--color-gray-600);
        flex-shrink: 0;
        font-size: var(--font-size-xs);
    }

    .row-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: var(--spacing-sm);
        border-top: var(--border-table);
        margin-top: var(--spacing-sm);
    }

    .action-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Define amount of columns the table has */
.table-list-2-columns {
    --table-list-colum-count: 2;
}

.table-list-3-columns {
    --table-list-colum-count: 3;
}

.table-list-4-columns {
    --table-list-colum-count: 4;
}

.table-list-5-columns {
    --table-list-colum-count: 5;
}
/* The question form's classification picker. Checkboxes, not a select: a question carries
   zero or more tags, across more than one namespace. See docs/adr/0013-question-tags.md. */
.tag-picker {
    padding-top: var(--spacing-sm);
    border-top: var(--border-separator);
}

.tag-picker-namespace {
    margin-top: var(--spacing-sm);
}

.tag-picker-namespace-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-primary);
}

.tag-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.tag-picker-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
}

/* The heading is the tag that groups the checkboxes under it, an eixo over its dimensões, and
   is never itself selectable. */
.tag-picker-group-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.tag-picker-choice {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xs);
    cursor: pointer;
}

.tag-picker-choice input {
    margin-top: 2px;
}

/* A question's tags in a list row, where several have to read as separate values in one cell. */
.tag-chip {
    display: inline-block;
    padding: 0 var(--spacing-xxs);
    margin: 0 var(--spacing-xxs) var(--spacing-xxs) 0;
    border: var(--border-xxxs);
    border-radius: var(--border-radius-md);
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.tag-group-switch {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.tag-namespace-list {
    display: flex;
    flex-direction: column;
    margin-top: var(--spacing-md);
}

.tag-namespace-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    border-bottom: var(--border-separator);
    color: inherit;
    text-decoration: none;
}

.tag-namespace-row:last-child {
    border-bottom: none;
}

.tag-namespace-row-label {
    font-weight: 600;
    color: var(--color-text-primary);
}

.tag-namespace-row-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.tag-namespace-actions {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-xs);
}

.tag-edit-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

/* One row per tag: name, where it groups under, how many questions carry it, and the two
   actions. It wraps instead of shrinking, so the name stays readable on a narrow screen. */
.tag-edit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs);
}

.tag-edit-row .input {
    flex: 2 1 200px;
}

.tag-edit-row .select {
    flex: 1 1 180px;
}

.tag-edit-count {
    flex: 0 0 auto;
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

/* Creating a subclassification sits inside the card of the tag it goes under, which is where the
   questions it may carry down are shown. */
.tag-subtag-form {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: var(--border-separator);
}

.tag-subtag-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-primary);
}

.tag-subtag-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.tag-subtag-row .input {
    flex: 2 1 200px;
}

.tag-subtag-move {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.text-muted {
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
}

.text-danger {
    color: var(--color-danger);
    font-size: var(--font-size-xs);
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.header {
    color: var(--color-header);
    font-weight: bold;
    font-size: 16px;
    margin: 16px 0;
    text-align: center;
}

.semi-header {
    color: var(--color-header);
    font-size: 16px;
    margin: 16px 0;
    text-align: center;
}
/* Toast Container */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

.toast.removing {
    animation: slideOut 0.3s ease-in forwards;
}

.toast-success {
    border-left-color: var(--color-success);
    background: var(--color-success-muted);
}

.toast-error {
    border-left-color: var(--color-danger);
    background: var(--color-danger-muted);
}

.toast-warning {
    border-left-color: var(--color-warning);
    background: var(--color-warning-muted);
}

.toast-info {
    border-left-color: var(--color-primary);
    background: var(--color-primary-muted);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.toast-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    color: var(--gray-400);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--gray-600);
}

/* A 300px minimum plus the container's own offsets is wider than the narrowest phones, which
   pushed the toast off-screen; on mobile it spans whatever is between the two edges instead. */
@media (max-width: 480px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
/* to hide, but still be useful for screen-reader (eg use in loading spinner description) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
/* Build marker, pinned to the corner of every page so a support conversation can start from which
   release the person is actually looking at. The respondent flow overrides the positioning, see
   respondent.css. */
.version-tag {
    position: fixed;
    right: var(--spacing-md);
    bottom: var(--spacing-md);
    /* Under the sidebar overlay (99), so the mobile drawer dims it along with the rest of the page. */
    z-index: 98;
    font-size: var(--font-size-xxs);
    /* Inherited from body, so it stays readable on the pages that paint their own background
       (the 404's gradient), and the opacity is what keeps it out of the way everywhere. */
    color: inherit;
    opacity: 0.5;
    /* Nothing here is clickable: it must never eat a click meant for the page underneath. */
    pointer-events: none;
    user-select: none;
}

