:root {
    --bg: #f8f8f8;
    --surface: #ffffff;
    --text: #1d1c1d;
    --text-muted: #616061;
    --border: #dddddd;
    --accent: #611f69;
    --accent-hover: #4a154b;
    --accent-contrast: #ffffff;
    --success: #007a5a;
    --success-bg: #e6f4ef;
    --danger: #e01e5a;
    --danger-bg: #fceaf0;
    --warning: #9c6f19;
    --warning-bg: #fbf1dc;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    margin-bottom: 24px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    text-decoration: none;
}

h1 {
    font-size: 1.5rem;
    margin: 8px 0 4px;
}

h2 {
    font-size: 1.15rem;
    margin: 0 0 12px;
}

.subtitle {
    color: var(--text-muted);
    margin: 0 0 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
}

.field {
    margin-bottom: 18px;
}

.field-row {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

@media (min-width: 640px) {
    .field-row {
        flex-direction: row;
    }
    .field-row .field {
        flex: 1;
        margin-bottom: 0;
    }
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(97, 31, 105, 0.15);
}

textarea {
    resize: vertical;
}

.slot-row,
.invitee-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.slot-row {
    flex-wrap: wrap;
}

.slot-row input[type="datetime-local"] {
    flex: 1;
    min-width: 200px;
}

.invitee-row input {
    flex: 1;
}

.btn-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.btn-remove:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
    width: 100%;
}

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

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

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (min-width: 640px) {
    .btn-primary {
        width: auto;
    }
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.share-link {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.share-link input {
    flex: 1;
    min-width: 200px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
}

/* Availability grid */
.grid-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table.grid {
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
    background: var(--surface);
}

table.grid th,
table.grid td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
    font-size: 0.9rem;
}

table.grid thead th {
    background: #faf7fb;
    font-weight: 600;
    position: sticky;
    top: 0;
}

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

.slot-best {
    background: var(--success-bg);
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-yes {
    background: var(--success-bg);
    color: var(--success);
}

.badge-no {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-maybe {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-pending {
    background: #eee;
    color: var(--text-muted);
}

.availability-choice {
    display: flex;
    gap: 8px;
}

.availability-choice label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 0;
}

.availability-choice input {
    margin: 0;
}

.slot-question {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 14px;
}

.finalize-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.slot-time {
    font-weight: 600;
    margin-bottom: 10px;
}

.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.finalized-banner {
    background: var(--success-bg);
    color: var(--success);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

footer,
.footer-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    margin: 32px 0;
}
