/* Global Variables */
:root {
    --border-radius: 8px;
    --primary-color: #1a1d23;
    /* Charcoal */
    --primary-hover: #000000;
    --conflict-red: #ef4444;
    --font-serif: "Playfair Display", serif;
    --font-serif-2: "Prata", serif;
    --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

/* Light Mode: Warm Glass */
[data-theme="light"] {
    --bg-color: #f4f3f1;
    --matrix-bg: rgba(255, 255, 255, 1.0);
    --text-main: #1a1d23;
    /* Off-black */
    --muted-color: #64748b;
    --muted-border-color: rgba(0, 0, 0, 0.12);
    --highlight-color: rgba(0, 0, 0, 0.05);
    --conflict-bg: #fef2f2;
    --conflict-text: #991b1b;
    --tab-active-bg: #1a1d23;
    --tab-active-text: #ffffff;
    --striped-day-bg: #f7f7f7;
    --selected-grid-time: rgba(0, 200, 0, 0.1);
    --selected-matrix-timeslot: #EEE;
    --selected-matrix-timeslot-border: #AAA;
}

/* Dark Mode: High Contrast Slate */
[data-theme="dark"] {
    --bg-color: #0c0e12;
    --matrix-bg: #1a1d23;
    --text-main: #f8fafc;
    --muted-color: #94a3b8;
    --muted-border-color: rgba(255, 255, 255, 0.08);
    --highlight-color: rgba(255, 255, 255, 0.05);
    --conflict-bg: rgba(239, 68, 68, 0.2);
    --conflict-text: #fca5a5;
    --tab-active-bg: #f8fafc;
    --tab-active-text: #1a1d23;
    --striped-day-bg: rgba(255, 255, 255, 0.03);
    --selected-grid-time: rgba(0, 50, 0, 1.0);
    --selected-matrix-timeslot: rgba(255, 255, 255, 0.08);
    --selected-matrix-timeslot-border: #555;
}

[type=checkbox]:checked,
[type=checkbox]:checked:active,
[type=checkbox]:checked:focus,
[type=radio]:checked,
[type=radio]:checked:active,
[type=radio]:checked:focus {
    --pico-background-color: var(--primary-color);
    --pico-border-color: var(--primary-color);
}

html {
    background-color: var(--bg-color);
}

/* Force Light Theme */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.90rem;
    /* Tighter typography */
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease;
    margin: 0;
    padding: 0;
}

input[type="text"],
input[type="datetime-local"],
select,
textarea {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

label,
fieldset>legend {
    font-weight: bold;
}

html[data-theme] :focus-visible {
    border: 1px solid #AAA;
    outline: 1px solid white;
    box-shadow: 0 0 0 3px var(--primary-color);
    border-radius: 4px;
}

h1,
.poll-title {
    /* font-family: var(--font-serif-2); */
    font-weight: 700;
    color: var(--text-main);
    margin-top: 1rem;
}

.poll-title-compact {
    font-size: 1.5rem;
}

.poll-description-muted {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted-color);
}

.poll-duration-tag {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--muted-color);
    display: flex;
    align-items: center;
    font-weight: 500;
}

h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.01em;
}

article,
.day-card {
    background-color: var(--matrix-bg);
    color: var(--text-main);
    border: 1px solid var(--muted-border-color);
}

/* 
[data-theme="light"] .day-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
} */

/* Single source of truth for page-width containers.
   header.container, main.container, footer.container all inherit this. */
.container {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* article is not a .container but should share the same max-width */
article {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

nav ul:last-of-type {
    margin-right: 0;
}

[data-theme="light"] article,
[data-theme="light"] .day-card {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] article,
[data-theme="dark"] .day-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

/* Layout Utilities (replacing inline styles) */
.poll-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
    padding-right: 0.75rem;
}

a {
    color: var(--text-main);
    text-decoration: underline;
    transition: opacity 0.2s;
    text-underline-offset: 4px;
}

a:hover {
    opacity: 0.8;
}

.clear-btn {
    padding: 0.2rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    /* text-decoration: underline; */
    text-underline-offset: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    box-shadow: none;
    transition: opacity 0.2s;
}

.clear-btn:hover {
    opacity: 0.8;
    background-color: rgba(0, 0, 0, 0.05);
}

.no-margin {
    margin-bottom: 0;
}

.voter-input-group {
    margin-bottom: 1.5rem;
}

/* Raise specificity over Pico's input rule */
input.voter-name-input {
    max-width: 500px;
    height: 48px;
}

.matrix-table td.voter-name-cell {
    text-align: right;
    font-weight: 600;
}

.instruction-text {
    color: var(--muted-color);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 1.0rem;
    display: flex;
    align-items: center;
}

.warning-text {
    color: #d97706;
    margin-top: 1rem;
}

#open-philosophy-link {
    font-size: 1.1rem;
}

/* button.philosophy-trigger beats Pico's button selector */
button.philosophy-trigger,
a.philosophy-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    background: transparent;
    border: none;
    cursor: pointer;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
    box-shadow: none;
    padding: 0;
}

.philosophy-icon {
    width: 18px;
    height: 18px;
    margin: 0 0 0 4px;
}

.x-icon {
    width: 20px;
    height: 20px;
    stroke-width: 3;
}

.small-x-icon {
    width: 14px;
    height: 14px;
    stroke-width: 3;
}

button.philosophy-trigger:hover,
a.philosophy-trigger:hover {
    opacity: 1;
    background: var(--highlight-color);
}

.philosophy-trigger svg {
    width: 16px;
    height: 16px;
}

/* Primary Global Button Style */
button.primary,
.button.primary,
a.button.primary,
.save-btn {
    width: auto;
    padding: 0.8rem 2.5rem;
    border-radius: 6px;
    font-weight: 700;
    background-color: var(--tab-active-bg);
    color: var(--tab-active-text);
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    margin-top: 1rem;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    line-height: normal;
}

button.primary:hover,
.button.primary:hover,
a.button.primary:hover,
.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    filter: brightness(1.2);
}

[data-theme="light"] button.primary:hover,
[data-theme="light"] .button.primary:hover,
[data-theme="light"] a.button.primary:hover,
[data-theme="light"] .save-btn:hover {
    filter: brightness(0.85);
}

/* Outline/Secondary Button Style */
/* body prefix raises specificity over Pico's [role=button], button rule */
body button.outline,
body .button.outline,
body a.button.outline,
body .icon-btn.secondary,
body .share-btn.secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    box-shadow: none;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

body button.outline:hover,
body .button.outline:hover,
body a.button.outline:hover {
    background: rgba(26, 29, 35, 0.05);
    transform: translateY(-1px);
}

[data-theme="dark"] body button.outline,
[data-theme="dark"] body .button.outline,
[data-theme="dark"] body a.button.outline {
    color: var(--text-main);
    border-color: var(--text-main);
}

[data-theme="dark"] body button.outline:hover,
[data-theme="dark"] body .button.outline:hover,
[data-theme="dark"] body a.button.outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    input.voter-name-input {
        max-width: 100%;
        width: 100%;
    }

    .save-btn,
    button.primary,
    .button.primary,
    a.button.primary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .success-link-row {
        flex-direction: column;
        align-items: stretch;
    }

    .success-view-poll-btn {
        width: 100%;
    }

    /* Hide "Respondents" text at mobile widths; keep the cell for layout */
    .participants-header {
        font-size: 0;
        color: transparent;
    }

    .participants-header::after {
        content: "";
    }
}

/* Dual-Mode Toggle (Segmented Control) */
.mode-toggle {
    display: flex;
    width: fit-content;
    border-radius: 6px;
    /* padding: 0.25rem;
    border-radius: 6px;
    border: 1px solid var(--muted-border-color);
    background: #f6f6f6; */
    margin-top: 1.5rem;
    background: transparent;
    border: none;
    padding: 0;

}

[data-theme="dark"] .mode-toggle {
    background: transparent;
}

[data-theme="dark"] .mode-toggle button[data-active="true"] {
    color: white;
    border-color: white;
}

.mode-toggle button {
    border: none;
    background: transparent;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0;
    color: var(--muted-color);
    text-align: center;
    white-space: nowrap;
}

.mode-toggle button:hover:not([data-active="true"]) {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mode-toggle button:hover:not([data-active="true"]) {
    background: rgba(255, 255, 255, 0.05);
}

.mode-toggle button[data-active="true"] {
    color: var(--primary-color);
    /* background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    border-radius: 4px; */
    background: transparent;
    box-shadow: none;
    border-bottom: 4px solid var(--primary-color);
    border-radius: 0;

}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 600px) {
    .dashboard-grid {
        gap: 0.75rem;
    }

    .mode-toggle {
        width: 100%;
        box-sizing: border-box;
    }

    .mode-toggle button {
        flex: 1;
        padding: 0.5rem 0.25rem;
    }
}

.button.margin-0,
a.button.margin-0,
button.margin-0 {
    margin: 0;
}

.day-card {
    border-radius: var(--pico-border-radius);
    padding: 1.0rem;
    max-width: 500px;
}

.day-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.day-header h4 {
    margin: 0;
    font-size: 0.90rem;
    font-weight: 700;
    color: var(--text-main);
}

.day-header .date-label {
    font-size: 0.8rem;
    color: var(--muted-color);
}

.pill-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Time Pills (Input UI) */
.time-pill {
    --pico-background-color: var(--pico-form-element-background-color);
    --pico-border-color: var(--pico-form-element-border-color);
    --pico-color: var(--pico-form-element-color);
    background: var(--pico-form-element-background-color);
    border: 1px solid var(--pico-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    /* Tighter */
    /* background: var(--matrix-bg);
    border: 1px solid var(--muted-border-color); */
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    gap: 1rem;
    min-height: 48px;
}

.time-pill .pill-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-pill:hover {
    transform: translateY(-1px);
    background: var(--highlight-color);
}

.time-pill[data-status="1"] {
    color: var(--text-main);
}

.time-pill[data-status="1"] .pill-icon {
    color: var(--muted-border-color);
}

.time-pill[data-status="1"] .chk-icon-outline {
    color: var(--muted-border-color);
}

.time-pill[data-status="0"] {
    background-color: var(--conflict-bg);
    border-color: var(--conflict-red);
    color: var(--conflict-text);
}

.pill-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

/* Matrix Minimap (mobile bird's-eye navigator) */
.matrix-minimap {
    display: none;
    /* desktop: hidden, table is fully visible */
}

.matrix-minimap-container {
    display: none;
}


@media (max-width: 600px) {
    .matrix-minimap {
        display: flex;
        gap: 6px;
        width: 100%;
        overflow: hidden;
        margin-bottom: 1rem;
        background: var(--matrix-bg);
        border-radius: 8px;
        align-items: stretch;
        display: none;
    }

    /* 0,2,0 beats .matrix-minimap-container's 0,1,0 */
    .matrix-minimap-container {
        display: block;
        margin-top: 1.5rem;
        background: transparent;
        border: none;
        padding: 0;
        display: none;
    }

    .matrix-minimap-container summary.minimap-summary {
        display: block;
        /* Hard reset from flex/pico */
        list-style: none;
        appearance: none;
        cursor: pointer;
        padding: 0;
        margin-bottom: 0.5rem;
        user-select: none;
        background: none;
    }

    .matrix-minimap-container summary.minimap-summary::-webkit-details-marker,
    .matrix-minimap-container summary.minimap-summary::marker,
    .matrix-minimap-container summary.minimap-summary::before,
    .matrix-minimap-container summary.minimap-summary::after {
        display: none;
        content: none;
        background: none;
    }

    .matrix-minimap-container .summary-content {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        color: var(--pico-color);
        font-weight: 700;
        font-size: 0.9rem;
        transition: color 0.1s ease;
    }

    .matrix-minimap-container summary:hover .summary-content,
    .matrix-minimap-container[open] .summary-content {
        color: var(--pico-h2-color);
    }

    /* Style the Lucide icons */
    .matrix-minimap-container .summary-content i {
        width: 16px;
        height: 16px;
        opacity: 0.8;
    }

    /* Chevron Logic: Up when closed, Down when open */
    .matrix-minimap-container .icon-down {
        display: none;
    }

    .matrix-minimap-container[open] .icon-up {
        display: none;
    }

    .matrix-minimap-container[open] .icon-down {
        display: inline-block;
    }

    .matrix-minimap-container .matrix-minimap {
        padding: 0.5rem 0 0 0;
    }

    .minimap-row-labels {
        display: flex;
        flex-direction: column;
        gap: 1px;
        flex-shrink: 0;
        padding: 2px 0;
    }

    .minimap-row-label {
        height: 12px;
        font-size: 12px;
        font-weight: 700;
        line-height: 12px;
        color: var(--muted-color);
        text-align: right;
        letter-spacing: 0;
        user-select: none;
    }

    .minimap-cols {
        display: flex;
        flex: 1;
        gap: 2px;
        min-width: 0;
    }

    .minimap-col {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1px;
        cursor: pointer;
        border-radius: 3px;
        padding: 2px;
        transition: background 0.15s, transform 0.1s;
    }

    .minimap-col:hover {
        background: var(--highlight-color);
    }

    .minimap-col.active {
        background: var(--highlight-color);
        transform: scaleY(1.08);
    }

    .minimap-cell {
        height: 12px;
        border-radius: 1px;
        width: 100%;
    }

    .minimap-cell[data-status="0"] {
        background: var(--conflict-red);
        opacity: 0.85;
    }

    .minimap-cell[data-status="1"] {
        background: var(--muted-border-color);
        opacity: 0.5;
    }
}

/* Matrix (Group View) */
.matrix-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: none;
    background: var(--matrix-bg);
}

.matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.matrix-table th,
.matrix-table td {
    padding: 0.25rem 0.5rem;
    text-align: center;
    background: transparent;
    min-width: 80px;
}

/* .matrix-table td already more specific than Pico's td rule */
.matrix-table td {
    border-bottom: 1px solid var(--muted-border-color);
}

.matrix-table th.highlight-active,
.matrix-table td.highlight-active {
    background-color: var(--selected-matrix-timeslot) !important;
    cursor: pointer;
    border-top: 5px solid var(--selected-matrix-timeslot-border);
}

.flipped-matrix .matrix-table td.highlight-active,
.flipped-matrix .matrix-table th.highlight-active {
    border-left: 5px solid var(--selected-matrix-timeslot-border);
    border-top: 0;
}

.matrix-table td.highlight-cell {
    background-color: var(--selected-matrix-timeslot) !important;
}


.matrix-table .striped-day {
    background-color: var(--striped-day-bg);
}

.matrix-utility-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.matrix-utility-row .instruction-text {
    margin: 0;
}

/* Flipped Matrix Specifics */
.flipped-matrix .participant-col-header {
    min-width: 48px;
    max-width: 80px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    border-width: 1px;
}

.flipped-matrix .timeslot-row-label {
    text-align: right;
    padding: 0.5rem 0.5rem;
    white-space: nowrap;
    cursor: pointer;
}

.flipped-matrix .row-label-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.flipped-matrix .row-weekday {
    font-size: 0.80rem;

    font-weight: 600;
}

.flipped-matrix .row-time {
    font-size: 0.7rem;
    color: var(--muted-color);
    margin-top: 0.25rem;
}

/* Axis Toggle Button */
.axis-flip-btn {
    padding: 6px;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-bottom: 0;
    margin-right: 1rem;
}

.axis-flip-btn:hover {
    opacity: 1;
    background: var(--muted-border-color);
}

.axis-flip-btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}



.mode-toggle .main-modes {
    display: flex;
    flex: 1;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.mode-toggle .main-modes button {
    flex: 1;
}

.suggested-time-label {
    margin-top: 1rem;
}

/* Suggested Time Slot Card */
.suggested-slot-card {
    padding: 1rem 1.25rem;
    background: var(--matrix-bg);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background-color: rgba(50, 200, 0, 0.05);
    border: 1px solid rgba(0, 175, 0, 0.5);
    box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    /* Success green */
}

.suggested-slot-left {
    display: flex;
    align-items: center;
    gap: 1.0rem;
}

.consensus-check-icon {
    width: 30px;
    height: 30px;
    color: #10b981;
    flex-shrink: 0;
}

.suggested-slot-card.warning {
    background-color: rgba(255, 165, 0, 0.08);
    border-color: rgba(217, 119, 6, 0.5);
}

.suggested-slot-card.warning .consensus-check-icon {
    color: #d97706;
}

.suggested-slot-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.suggested-time {
    font-weight: 700;
    color: var(--text-main);
}

.suggested-consensus {
    font-size: 0.8rem;
    color: var(--muted-color);
    font-weight: 500;
}

.calendar-btn-row {
    margin-top: 0;
    flex-shrink: 0;
}

.compact-button {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

@media (max-width: 600px) {
    .suggested-slot-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .calendar-btn-row {
        width: 100%;
    }

    .compact-button {
        justify-content: center;
    }
}

.matrix-table .sticky-column {
    border-right: 1px solid var(--muted-border-color);
    box-shadow: 4px 0 8px -4px rgba(0, 0, 0, 0.10);
}

/* Sticky Columns */
/* .matrix-table .sticky-column already specific; plain .sticky-column uses body prefix */
.sticky-column {
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--matrix-bg) !important;
    min-width: 120px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 150px;
}

.sticky-column.striped-day {
    background-color: var(--striped-day-bg) !important;
}

@media (max-width: 600px) {
    .sticky-column {
        min-width: 100px;
        max-width: 100px;
    }
}

[data-theme="light"] .sticky-column {
    background: #ffffff;
}

th.participants-header {
    vertical-align: middle;
    border-bottom: 1px solid var(--muted-border-color);
    vertical-align: bottom;
    padding-bottom: 0.5rem;
    text-align: right;
}


/* Matrix Abstract Cells */
/* .matrix-table .matrix-cell beats Pico's td padding rule */
.matrix-table .matrix-cell {
    height: 48px;
    padding: 0;
    vertical-align: middle;
}

.matrix-block {
    margin: 0 auto;
    /* width: 32px; */
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
    margin: 0.5rem;
}

.matrix-block[data-status="0"] {
    background-color: var(--conflict-bg);
    border-color: var(--conflict-red);
    color: var(--conflict-text);
    border: 1px solid var(--conflict-red);
}

.matrix-block[data-status="1"] {
    /* background-color: var(--highlight-color); */
    /* background-color: rgba(0, 255, 0, 0.10); */
    opacity: 1;
    /* border: 1px solid rgba(0, 100, 0, 0.5); */
}

.matrix-block[data-status="1"]::after {
    content: "✓";
    font-size: 1.0rem;
    color: rgba(0, 120, 0, 0.7);
    font-weight: 700;
}

/* Optimal Indicators */
.optimal-column .time {
    font-weight: 600;
}

/* Time Headers */
.header-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* .matrix-table th.time-header beats Pico's th rule */
.matrix-table th.time-header {
    padding: 12px 8px;
    white-space: nowrap;
    border-bottom: 1px solid var(--muted-border-color);
    cursor: pointer;
}

.time-header .time {
    font-size: 0.70rem;
    font-weight: 500;
    color: var(--muted-color);
}

.score-row {
    display: none;
}

.day-group-header {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-main);
    border-bottom: 0;
    line-height: 1.2;
}

th.day-group-header {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}

.matrix-controls {
    margin-bottom: 2rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-text {
    color: var(--muted-color);
}

/* Success Receipt */
.success-receipt {
    background: var(--matrix-bg);
    border: 2px solid var(--muted-border-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.success-receipt h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}



/* Footer Toggles */
.app-footer {
    text-align: center;
    margin-top: 3rem;
    padding-bottom: 4rem;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    flex-wrap: nowrap;
}

.footer-content a,
.footer-content span {
    white-space: nowrap;
    display: inline-block;
}

.footer-content a {
    transition: color 0.2s;
}

.footer-content a:hover {
    color: var(--text-main);
    text-decoration: underline;
}

.footer-separator {
    color: var(--primary-color);
}

.footer-theme-toggle {
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    user-select: none;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--highlight-color);
}

.footer-theme-toggle:hover {
    opacity: 1;
    background: var(--muted-border-color);
}

/* Creation View Fixes */
/* .slot-row is a custom class — no Pico rule to fight */
.slot-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    .slot-row {
        gap: 0;
    }
}

/* .slot-row input raises specificity over Pico's input rule */
.slot-row input {
    flex: 1;
    margin-bottom: 0;
}

/* button.remove-btn beats Pico's button rule */
.slot-row button.remove-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: none;
    margin-bottom: 0;
}

/* Embedded Input Buttons (Success View) */
.input-with-button {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* .input-with-button input beats Pico's input rule */
.input-with-button input {
    padding-right: 48px;
    margin-bottom: 0;
}

/* .input-with-button button.embedded-icon-btn beats Pico's button rule */
.input-with-button button.embedded-icon-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-color);
    opacity: 0.6;
    transition: opacity 0.2s;
    box-shadow: none;
    margin-top: 0.25rem;
}

.input-with-button button.embedded-icon-btn:hover {
    opacity: 1;
    transform: none;
}

/* Subtle Action Buttons */
.header-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
    align-self: flex-start;
}

/* .header-actions button beats Pico's button rule via descendant combinator */
.header-actions button {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.header-actions button:hover {
    opacity: 1;
    filter: brightness(0.9);
}

[data-theme="dark"] .header-actions button:hover {
    filter: brightness(1.2);
}

.header-actions .icon-btn {
    padding: 0.3rem 0.5rem;
}

.private-edit-link {
    font-weight: 500;
    opacity: 1;
    display: none;
}

/* Form Errors */
.form-error {
    color: #991b1b;
    /* Muted darkish red */
    font-size: 0.75rem;
    margin-top: -0.75rem;
    margin-bottom: 1rem;
    display: block;
    font-weight: 600;
    transition: all 0.2s ease;
}

:where(input, select, textarea)[aria-invalid=true] {
    border-width: 2px;
}

.slot-row+.form-error {
    margin-top: -0.25rem;
    margin-bottom: 0.75rem;
}

/* Toasts */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d23;
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 300px;
    justify-content: space-between;
}

[data-theme="dark"] .toast-notification {
    background: #f8fafc;
    color: #1a1d23;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
}

.toast-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.6;
}

.toast-close:hover {
    opacity: 1;
}

.success-view-poll-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    margin-top: 0;
    margin-bottom: 0;
    flex: 0 0 auto;
    text-align: center;
}

.success-link-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.success-link-display {
    flex: 1;
}

.chevron-right {
    font-size: 1.2rem;
    line-height: 1;
}

/* Transitions */
.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s ease;
}

/* Landing Page Styles */
@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.animate-rise-in {
    opacity: 0;
    animation: rise-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-150 {
    animation-delay: 150ms;
}

.delay-300 {
    animation-delay: 300ms;
}


article.landing-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    background: transparent;
    border: none;
    box-shadow: none;
}

.hero-content {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.hero-headline {
    font-size: clamp(2.5rem, 10vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.hero-subheadline {
    font-size: 1.25rem;
    color: var(--muted-color);
    margin-bottom: 3rem;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* a.button.primary.hero-cta beats Pico's button rule */
a.button.primary.hero-cta {
    padding: 1.0rem 4.5rem;
    font-size: 1.25rem;
    margin-top: 0;
}

dialog article>header .close,
dialog article>header :is(a, button)[rel=prev] {
    margin-top: 0.25rem;
}

dialog article>header h3 {
    font-size: 1.25rem;
}

dialog article.grid-modal-article>footer,
dialog article.grid-modal-article>header {
    margin: 0;
}

dialog article.grid-modal-article>header {
    border-bottom: 1px solid var(--muted-border-color);
    box-shadow: 0 10px 10px rgba(0, 0, 0, 0.05);
    z-index: 9;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Standard footer alignment */
    gap: 1rem;
    padding: 1.0rem;
    /* Equal padding on all sides as requested */
    border-top: 1px solid var(--muted-border-color);
    background: var(--matrix-bg);
    flex-shrink: 0;
}

/* Grid Selector Modal */
.grid-modal-article {
    max-width: 95vw;
    width: 1200px;
    height: 90vh;
    /* Fixed height for consistency */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    overflow: hidden;
    /* Prevent article itself from scrolling */
}

dialog article.grid-modal-article>header {
    /*padding: 1.5rem 2rem;*/
    padding: 1.5rem 2rem 0 2rem;
    /* Force comfortable padding */
    border-bottom: 1px solid var(--muted-border-color);
}

main>article>header {
    /*padding-bottom: auto;*/
    padding-bottom: 0;
    margin-bottom: 2rem;
}

.grid-modal-header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.checkbox-label {
    margin-bottom: var(--pico-spacing);
}

.grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2.0rem;
    padding: 0.5rem 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toolbar-group.week-nav {
    gap: 0;
}

.toolbar-group.boundaries {
    gap: 0.5rem;
}

.week-range-text {
    font-weight: 700;
    font-size: 0.95rem;
    /* min-width: 160px;
    text-align: center; */
    text-align: left;
}

.compact-btn {
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    height: 32px;
    text-decoration: none;
}

.compact-btn:first-of-type {
    margin-left: 0;
}

.mode-toggle.compact {
    padding: 2px;
    width: auto;
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 6px;
}

.mode-toggle.compact button {
    flex: none;
    padding: 4px 12px;
    font-size: 0.8rem;
    height: 28px;
    border-radius: 4px;
}

.compact-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.grid-toolbar .compact-select {
    width: auto;
    height: 32px;
    padding: 0 1.5rem 0 0.5rem;
    font-size: 0.85rem;
    margin: 0;
    background-position: right 0.4rem center;
}

.to-separator {
    color: var(--muted-color);
    font-size: 0.85rem;
}

/* Bulk Grid Layout */
.bulk-grid-container {
    flex: 1;
    overflow: auto;
    display: flex;
    /* padding: 1rem; */
    padding: 0;
    gap: 0;
    /* background: var(--bg-color); */
    background: var(--muted-border-color);
    =user-select: none;
}

.bulk-grid-day {
    flex: 1;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--muted-border-color);
    min-height: max-content;
}

.bulk-grid-day:last-child {
    border-right: none;
}

.grid-day-header {
    padding: 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--muted-border-color);
    background: var(--matrix-bg);
    position: sticky;
    top: 0;
    z-index: 5;
}

.grid-day-weekday {
    font-weight: 700;
    font-size: 0.85rem;
}

.grid-day-date {
    font-size: 0.75rem;
    color: var(--muted-color);
}

.bulk-grid-cell {
    height: 48px;
    min-height: 40px;
    border-bottom: 1px solid var(--muted-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    /* Slightly larger */
    color: var(--text-main);
    /* Darker for accessibility */
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    background: var(--matrix-bg);
}

/* .bulk-grid-day::after {
    content: "";
    display: block;
    height: 1rem;
    flex-shrink: 0;
} */

@media (hover: hover) {
    .bulk-grid-cell:hover {
        background: rgba(var(--highlight-color), 0.5);
    }
}

.bulk-grid-cell.selected {
    background-color: var(--selected-grid-time);
    /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
    z-index: 2;
}

.bulk-grid-cell.past {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
}

.grid-cell-label {
    opacity: 0.75;
}

.bulk-grid-cell.selected .grid-cell-label {
    opacity: 1;
}

/* Modal Footer - Handled above in consolidated rule */

.modal-footer button {
    margin: 0;
}

@media (max-width: 800px) {
    .grid-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
    }

    .toolbar-group {
        width: 100%;
    }

    .toolbar-group.week-nav {
        justify-content: flex-start;
    }

    .mode-toggle.compact {
        width: 100%;
        display: flex;
    }

    .mode-toggle.compact button {
        flex: 1;
    }

    .toolbar-group.boundaries {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .toolbar-group.boundaries .compact-label {
        flex: 1;
        margin: 0;
    }

    .toolbar-group.boundaries .compact-select {
        width: 100%;
    }

    .bulk-grid-day {
        min-width: 85px;
    }

    .matrix-table th,
    .matrix-table td {
        min-width: unset;
    }
}

.slot-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-right: 3rem;
}

.float-right {
    margin-left: auto;
}


/* Responsive Participant Labels */
.full-name {
    display: inline;
}

.initials {
    display: none;
}

@media (max-width: 600px) {
    .full-name {
        display: none;
    }

    .initials {
        display: inline;
    }
}