:root {
    --primary: #5b5bd6;
    --primary-dark: #4444c4;
    --primary-light: rgba(91, 91, 214, 0.08);
    --bg: #f4f4f9;
    --card-bg: #ffffff;
    --text: #1a1a24;
    --text-muted: #6b6b84;
    --border: #e0e0ec;
    --success: #16a05a;
    --success-light: rgba(22, 160, 90, 0.09);
    --warning: #c07800;
    --danger: #d0302f;
    --avail-yes: #4CAF50;
    --avail-yes-light: rgba(76, 175, 80, 0.09);
    --avail-maybe: #FF9800;
    --avail-no: #F44336;
    --dialog-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.05);
    --footer-height: 72px;
}

html.dark {
    --primary: #7c7cff;
    --primary-dark: #6060e0;
    --primary-light: rgba(124, 124, 255, 0.12);
    --bg: #0f0f18;
    --card-bg: #1a1a26;
    --text: #e8e8f2;
    --text-muted: #7878a0;
    --border: #28283c;
    --success: #2ebd72;
    --success-light: rgba(46, 189, 114, 0.12);
    --warning: #e0a020;
    --danger: #e86060;
    --avail-yes: #4CAF50;
    --avail-yes-light: rgba(76, 175, 80, 0.12);
    --avail-maybe: #FF9800;
    --avail-no: #F44336;
    --dialog-bg: #1a1a26;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Colourblind mode overrides */
html.cb {
    --avail-yes: #2196F3;
    --avail-yes-light: rgba(33, 150, 243, 0.12);
    --avail-maybe: #FFC107;
    --avail-no: #F44336;
}

html.dark.cb {
    --avail-yes: #2196F3;
    --avail-yes-light: rgba(33, 150, 243, 0.16);
    --avail-maybe: #FFC107;
    --avail-no: #F44336;
}

html,
body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 28px 20px;
}

.container-wide {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.icon-large {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary);
}

/* Brand row: logo + title side-by-side */
.brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.brand-row .site-title {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-row .icon-large {
    margin-bottom: 0;
    /* prevent extra gap when in row */
}

/* Small logo used inside back links */
.back-link .link-logo {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    background-image: url('/assets/logo_transparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

html.dark .back-link .link-logo {
    background-image: url('/assets/logo_dark_transparent.png');
}

/* Theme-aware site logo (uses background-image so CSS theme switches apply instantly) */
.icon-large .site-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px auto;
    background-image: url('/assets/logo_transparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
}

/* Dark theme logo override */
html.dark .icon-large .site-logo {
    background-image: url('/assets/logo_dark_transparent.png');
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}

.tagline {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 6px;
}

.description {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(91, 91, 214, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

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

.btn-danger:hover {
    background: #b92f2e;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(208, 48, 47, 0.22);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.975rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.55;
}

.form-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 9px;
    margin-bottom: 6px;
    border: 1.5px solid transparent;
    transition: border-color 0.15s;
}

.option-row:focus-within {
    border-color: var(--primary-light);
}

.option-date {
    font-weight: 500;
    font-size: 0.9rem;
}

.option-buttons {
    display: flex;
    gap: 5px;
}

.option-btn {
    padding: 5px 14px;
    border-radius: 100px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.12s;
}

.option-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.option-btn.selected-yes {
    background: var(--avail-yes);
    border-color: var(--avail-yes);
    color: white;
}

.option-btn.selected-maybe {
    background: var(--avail-maybe);
    border-color: var(--avail-maybe);
    color: white;
}

.option-btn.selected-no {
    background: var(--avail-no);
    border-color: var(--avail-no);
    color: white;
}

input[type="radio"] {
    display: none;
}

input[type="radio"]:checked+.option-btn.yes-btn {
    background: var(--avail-yes);
    border-color: var(--avail-yes);
    color: white;
}

input[type="radio"]:checked+.option-btn.maybe-btn {
    background: var(--avail-maybe);
    border-color: var(--avail-maybe);
    color: white;
}

input[type="radio"]:checked+.option-btn.no-btn {
    background: var(--avail-no);
    border-color: var(--avail-no);
    color: white;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 4px;
}

.responses-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.responses-table th,
.responses-table td {
    padding: 9px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.responses-table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding-bottom: 10px;
}

.responses-table th:first-child,
.responses-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--card-bg);
    z-index: 1;
}

.responses-table tbody tr:last-child td {
    border-bottom: none;
}

.response-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.response-actions form {
    margin: 0;
}

.responses-table tbody tr:hover td {
    background: var(--bg);
}

.responses-table tbody tr:hover td:first-child {
    background: var(--bg);
}

.status-yes {
    color: var(--avail-yes);
}

.status-maybe {
    color: var(--avail-maybe);
}

.status-no {
    color: var(--avail-no);
}

.status-icon {
    vertical-align: middle;
}

.poll-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: 9px;
    border: 1.5px solid var(--border);
    word-break: break-all;
    font-family: ui-monospace, 'SFMono-Regular', 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.copy-btn {
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: background 0.15s;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

.success-message {
    background: var(--success-light);
    border: 1.5px solid var(--success);
    color: var(--success);
    padding: 12px 16px;
    border-radius: 9px;
    margin-bottom: 14px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.back-link:hover {
    color: var(--primary);
}

.date-list {
    list-style: none;
}

.date-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 7px;
    margin-bottom: 5px;
    border: 1.5px solid transparent;
    font-size: 0.9rem;
}

.remove-date {
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 5px;
    transition: color 0.12s, background 0.12s;
}

.remove-date:hover {
    color: var(--danger);
    background: rgba(208, 48, 47, 0.08);
}

.poll-item a {
    text-decoration: none;
}

.remove-poll:hover {
    color: var(--danger);
    background: rgba(208, 48, 47, 0.06);
}

#dates-container {
    margin-bottom: 16px;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.theme-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 10010;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 5px;
    box-shadow: var(--shadow);
}

.theme-btn {
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.theme-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.theme-btn.active {
    background: var(--primary);
    color: white;
}

/* Show strikethrough on the colourblind toggle when it's not active */
#cbToggleBtn:not(.active) {
    text-decoration: line-through;
}

dialog {
    background: var(--dialog-bg);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10006;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

dialog[open] {
    display: block;
}

.site-content {
    flex: none;
    min-height: 100vh;
}

.site-footer {
    background: var(--card-bg);
    border-top: 1.5px solid var(--border);
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer a:hover {
    color: var(--primary-dark);
}

.footer-links {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
}

.site-footer p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 520px) {
    .site-footer {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
    }
}

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1.5px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding: 20px;
    z-index: 10005;
    display: none;
}

.cookie-banner.show {
    display: block;
}

.cookie-banner-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-banner-text {
    flex: 1;
    min-width: 250px;
    font-size: 0.9rem;
    color: var(--text);
}

.cookie-banner-text a {
    color: var(--primary);
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 12px;
}

@media (max-width: 640px) {
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-banner-actions {
        flex-direction: column;
    }
}

/* Calendar & small components styles from other pages */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.cal-nav {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text);
    transition: all 0.15s;
}

.cal-nav:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.cal-title {
    font-weight: 600;
    font-size: 0.95rem;
}

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

.cal-day-name {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.12s;
    border: 2px solid transparent;
    position: relative;
}

.cal-day:not(.past):not(.empty):not(.locked):hover {
    background: var(--primary-light);
    color: var(--primary);
}

.cal-day.empty {
    cursor: default;
}

.cal-day.past:not(.existing) {
    color: var(--text-muted);
    opacity: 0.35;
    cursor: not-allowed;
}

.cal-day.today {
    font-weight: 700;
    border-color: var(--primary);
    color: var(--primary);
}

.cal-day.selected {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-color: transparent;
}

.cal-day.selected.existing {
    background: var(--success);
}

.cal-day.selected.new {
    background: var(--primary);
}

.cal-day.locked {
    cursor: not-allowed;
    opacity: 0.8;
}

.cal-day .lock-icon {
    position: absolute;
    font-size: 8px;
    bottom: 2px;
    right: 2px;
}

.date-item-new {
    background: var(--primary-light);
    border-color: var(--primary);
}

.date-item.existing {
    background: var(--success-light);
    border-color: var(--success);
}

.remove-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    font-size: 14px;
}

.edit-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    opacity: 0.7;
    /* Inherit text color so the SVG (using currentColor) matches the participant name */
    color: inherit;
    transition: opacity 0.2s;
}

.edit-icon:hover {
    opacity: 1;
}

/* Ensure inline SVG uses currentColor for fill/stroke and matches surrounding text color */
.edit-icon svg {
    vertical-align: middle;
    color: inherit;
    fill: currentColor;
}

.current-user-row {
    background: var(--primary-light);
}

.participant-name {
    font-weight: 500;
}

/* ── Poll-view calendar ──────────────────────────────────────────────────── */

.view-toggle-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.view-toggle-btn {
    flex: 1;
    padding: 7px 14px;
    border-radius: 100px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.12s;
}

.view-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.view-toggle-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pv-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

/* Locked (non-option) day in the poll-view calendar */
.cal-day.pv-cal-locked {
    color: var(--text-muted);
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

/* Option day — taller cells with inline content */
.cal-day.pv-cal-option {
    aspect-ratio: unset;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 3px 3px;
    gap: 2px;
    cursor: default;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    min-height: 68px;
}

/* Status-coloured option days */
.cal-day.pv-cal-yes {
    background: color-mix(in srgb, var(--avail-yes) 12%, transparent);
    border-color: var(--avail-yes);
    color: var(--avail-yes);
}

.cal-day.pv-cal-maybe {
    background: color-mix(in srgb, var(--avail-maybe) 12%, transparent);
    border-color: var(--avail-maybe);
    color: var(--avail-maybe);
}

.cal-day.pv-cal-no {
    background: color-mix(in srgb, var(--avail-no) 12%, transparent);
    border-color: var(--avail-no);
    color: var(--avail-no);
}

/* Day number at the top-left of an option cell */
.pv-day-num {
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    line-height: 1;
    color: inherit;
    padding-left: 1px;
}

/* Column of Y / M / N buttons inside an unanswered (or editing) cell */
.pv-day-btns {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.pv-btn {
    flex: 1;
    border: none;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 0;
    cursor: pointer;
    line-height: 1;
    transition: background 0.1s, color 0.1s;
}

.pv-btn:hover {
    filter: brightness(0.85);
}

.pv-btn-yes {
    background: transparent;
    border: 1.5px solid var(--avail-yes);
    color: var(--avail-yes);
}

.pv-btn-yes:hover {
    background: var(--avail-yes);
    color: white;
}

.pv-btn-maybe {
    background: transparent;
    border: 1.5px solid var(--avail-maybe);
    color: var(--avail-maybe);
}

.pv-btn-maybe:hover {
    background: var(--avail-maybe);
    color: white;
}

.pv-btn-no {
    background: transparent;
    border: 1.5px solid var(--avail-no);
    color: var(--avail-no);
}

.pv-btn-no:hover {
    background: var(--avail-no);
    color: white;
}

/* Answer label shown in an already-answered cell */
.pv-day-answer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    border-radius: 3px;
    padding: 2px 1px;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: filter 0.1s;
}

.pv-day-answer:hover {
    filter: brightness(1.1);
}

.pv-ans-yes {
    background: var(--avail-yes);
}

.pv-ans-maybe {
    background: var(--avail-maybe);
}

.pv-ans-no {
    background: var(--avail-no);
}