* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f5f7;
    color: #1a1a1a;
    margin: 0;
}
.site-header {
    background: #111827;
    padding: 1rem 1.5rem;
}
.site-header .brand {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card-narrow { max-width: 420px; margin: 0 auto; }
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }
.muted { color: #6b7280; font-size: 0.9rem; }
.error { color: #b91c1c; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.75rem 0 0.25rem; }
input, textarea, select {
    width: 100%;
    min-width: 0;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23374151' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
/* iOS renders type=date with a much wider intrinsic size than other inputs;
   without min-width:0 on the flex/grid item, it can force the row to
   overflow past the card edge on iPhone/iPad. */
input[type="date"] {
    min-width: 0;
    box-sizing: border-box;
}
button, .button, .button-secondary {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    background: #111827;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
}
.button-secondary { background: #e5e7eb; color: #111827; }
.link-button {
    background: none;
    border: none;
    color: #2563eb;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

.session-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.session-table th, .session-table td {
    text-align: left;
    padding: 0.6rem 0.4rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}
.session-table .actions-col { width: 1%; white-space: nowrap; }
.actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.actions form { margin: 0; }
.best-row { background: #ecfdf5; }
.best-row td:first-child { font-weight: 600; }

.pb-line {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #d1d5db;
    font-size: 0.9rem;
    color: #374151;
}
.pb-line a { color: #2563eb; text-decoration: none; margin-left: 0.25rem; }
.pb-line a:hover { text-decoration: underline; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}
.pagination .button-secondary.disabled {
    opacity: 0.4;
    pointer-events: none;
}
.pagination span.button-secondary { margin-top: 0; }
.pagination a.button-secondary { margin-top: 0; }

.date-group { margin-top: 1.75rem; }
.date-group:first-of-type { margin-top: 1rem; }
.group-heading {
    font-size: 1rem;
    margin: 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #111827;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    margin: 0;
    font: inherit;
    line-height: 1;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
}
.icon-button:hover { background: #f3f4f6; }

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.form-row > div { min-width: 0; }
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

.corner-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (max-width: 640px) {
    .corner-grid { grid-template-columns: 1fr; }
}
.corner {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem 1rem 1rem;
}
.corner legend {
    font-weight: 600;
    padding: 0 0.4rem;
}
.form-actions { margin-top: 1.5rem; display: flex; gap: 1rem; align-items: center; }
