:root {
    --ink: #1f2933;
    --muted: #6b7683;
    --line: #e4e7eb;
    --accent: #2f7d4f;
    --accent-dark: #24603c;
    --warn: #b4690e;
    --danger: #c0392b;
    --card: #ffffff;
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 40px;
    background: #f5f5f5;
    color: var(--ink);
}

.hero-image {
    width: 600px;
    max-width: 100%;
    border-radius: 15px;
}

.widget,
.panel {
    margin: 30px auto;
    padding: 20px;
    max-width: 400px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

/* Utility class, so it has to beat the layout rules it's applied on top of.
   Several targets (.stacked-form, .comment-form) set `display: flex` with
   the same single-class specificity, and being defined later in the file
   they would otherwise win and leave the element visible. */
.hidden {
    display: none !important;
}

.status {
    min-height: 1.2em;
    color: var(--muted);
}

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

/* --- shared controls ------------------------------------------------- */

button.primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent-dark);
    border-radius: 6px;
}

button.primary:hover:not(:disabled) {
    background: var(--accent-dark);
}

button.secondary {
    background: #fff;
    color: var(--warn);
    border: 1px solid var(--warn);
    border-radius: 6px;
}

button.danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 6px;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* --- login page ------------------------------------------------------ */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.auth-card {
    background: var(--card);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 360px;
}

.auth-logo {
    width: 96px;
    border-radius: 12px;
}

.auth-card h1 {
    margin: 12px 0 2px;
    font-size: 24px;
}

.auth-subtitle {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px;
    font-size: 15px;
    color: var(--muted);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: bold;
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stacked-form input {
    padding: 10px;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

/* --- app shell ------------------------------------------------------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1000px;
    margin: -20px auto 24px;
    padding: 14px 20px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: left;
    flex-wrap: wrap;
}

.brand {
    font-size: 20px;
    font-weight: bold;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.user-menu button {
    padding: 6px 14px;
    font-size: 14px;
}

.app {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(320px, 1fr);
    gap: 24px;
    align-items: start;
    max-width: 1000px;
    margin: 0 auto;
}

.app .panel {
    margin: 0;
    max-width: none;
    text-align: left;
}

@media (max-width: 800px) {
    .app {
        grid-template-columns: 1fr;
    }
}

/* --- calendar -------------------------------------------------------- */

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

.cal-header h2 {
    margin: 0;
    font-size: 18px;
}

.cal-nav {
    background: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 18px;
    line-height: 1;
}

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

.cal-weekdays {
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cal-weekdays span {
    text-align: center;
}

.day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    font-size: 14px;
    color: var(--muted);
    font-family: inherit;
}

.day.blank {
    border: none;
}

/* Weekdays and Sundays with no session: visible, but plainly not clickable. */
.day.no-session {
    cursor: default;
}

.day.sunday {
    font-weight: bold;
    color: var(--ink);
}

.day-badge {
    font-size: 10px;
    font-weight: normal;
    line-height: 1;
}

.day.no-session .day-badge {
    display: none;
}

button.day {
    cursor: pointer;
}

.day.is-open {
    background: #eaf5ee;
    border-color: #bcdcc7;
    color: var(--accent-dark);
}

.day.is-full {
    background: #f2f3f5;
    border-color: var(--line);
    color: var(--muted);
}

.day.is-mine {
    background: var(--accent);
    border-color: var(--accent-dark);
    color: #fff;
}

.day.is-waitlisted {
    background: #fdf3e3;
    border-color: #e8c99a;
    color: var(--warn);
}

.day.is-past {
    opacity: 0.45;
}

.day.is-cancelled {
    background: #fbecea;
    border-color: #efc2bc;
    color: var(--danger);
    text-decoration: line-through;
}

.day.selected {
    outline: 2px solid var(--ink);
    outline-offset: 1px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    font-size: 12px;
    color: var(--muted);
}

.legend li {
    display: flex;
    align-items: center;
    gap: 5px;
}

.swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--line);
    display: inline-block;
}

.swatch.is-open {
    background: #eaf5ee;
    border-color: #bcdcc7;
}

.swatch.is-full {
    background: #f2f3f5;
}

.swatch.is-mine {
    background: var(--accent);
    border-color: var(--accent-dark);
}

/* --- session panel --------------------------------------------------- */

.session-panel h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.session-meta {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
}

.empty-hint {
    color: var(--muted);
    font-size: 14px;
}

.capacity-bar {
    height: 10px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.capacity-bar span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.capacity-text {
    margin: 6px 0 16px;
    font-size: 14px;
    color: var(--muted);
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.controls select {
    padding: 9px 10px;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.notice {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    background: #f2f3f5;
}

.notice.good {
    background: #eaf5ee;
    color: var(--accent-dark);
}

.notice.warn {
    background: #fdf3e3;
    color: var(--warn);
}

.notice.hint {
    background: #eef3f8;
    color: #3d5a75;
}

.session-panel h3 {
    margin: 18px 0 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.session-panel h3 .count {
    color: var(--ink);
}

.roster {
    list-style: none;
    margin: 0;
    padding: 0;
}

.roster li {
    display: flex;
    gap: 8px;
    padding: 7px 0;
    border-top: 1px solid var(--line);
    font-size: 15px;
}

.roster li:first-child {
    border-top: none;
}

.roster .pos {
    color: var(--muted);
    min-width: 22px;
    font-variant-numeric: tabular-nums;
}

.roster .guests {
    color: var(--muted);
    font-size: 13px;
}

.roster .you-tag {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 4px;
}

.roster .empty {
    color: var(--muted);
    font-size: 14px;
}

.roster.waitlist .pos {
    color: var(--warn);
}

.roster li .who {
    flex: 1;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.remove-btn:hover:not(:disabled) {
    background: #fbecea;
    color: var(--danger);
}

/* --- organiser controls ---------------------------------------------- */

.admin-box {
    margin-top: 20px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fafbfc;
}

.admin-box summary {
    cursor: pointer;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 14px 0 12px;
}

.admin-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.admin-grid input {
    padding: 7px 8px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.admin-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

/* --- comments -------------------------------------------------------- */

.comments-panel {
    max-width: 1000px;
    text-align: left;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.comment-form textarea,
.reply-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

.comment {
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

.comment-time {
    color: #888;
    font-size: 12px;
}

.comment-actions button {
    padding: 4px 10px;
    font-size: 13px;
    margin-right: 6px;
}

.reply-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}

.replies {
    margin-left: 24px;
    border-left: 2px solid var(--line);
    padding-left: 12px;
}
