:root {
    --border-color: #ccc;
}

body {
    text-transform: lowercase;
    font-family: sans-serif;
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
    color: #222;
}

body.wide {
    max-width: none;
}

nav {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

nav a {
    margin-right: 1rem;
}

.messages {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.message {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.message-error {
    border-color: #c00;
    color: #c00;
}

.message-success {
    border-color: #080;
    color: #080;
}

h1 {
    font-size: 1.4rem;
    margin-top: 2rem;
}

table.data-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1.5rem;
}

table.data-table th,
table.data-table td {
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.6rem;
    text-align: left;
}

table.data-table th {
    background: #f4f4f4;
}

table.data-table th,
table.data-table td {
    white-space: nowrap;
}

form.aligned {
    display: grid;
    grid-template-columns: max-content max-content;
    column-gap: 0.5rem;
    row-gap: 0.75rem;
    align-items: center;
}

form.aligned label {
    justify-self: end;
}

form.aligned input {
    justify-self: start;
    width: 220px;
}

form.aligned button {
    justify-self: start;
}

.field-error {
    grid-column: 2;
    color: #c00;
    font-size: 0.85rem;
    margin: 0;
}

button {
    cursor: pointer;
}

.page-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.session-title {
    display: block;
    font-weight: bold;
}

.session-description {
    display: block;
    color: #666;
    font-size: 0.85rem;
}

.table-wrap {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1.5rem;
}

.col-datum {
    width: 16rem;
    white-space: normal;
}

.datum-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.datum-row form {
    margin: 0;
    white-space: nowrap;
}

.table-wrap table.data-table {
    margin-bottom: 0;
}

.upload-form {
    margin-bottom: 1.5rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.gallery-item {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin: 0.4rem 0;
}

.gallery-controls {
    margin-top: 0.3rem;
}

.badge-denied {
    color: #c00;
}

.badge-shared {
    color: #080;
}

.badge-private {
    color: #666;
}

.pagination {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

/* Below this width, tables drop the header row and lay each row out as a
   labeled stack instead - the fixed-width columns + white-space:nowrap
   above are unusable on a phone-width viewport otherwise. */
@media (max-width: 700px) {
    table.data-table > tr:first-child {
        display: none;
    }

    table.data-table,
    table.data-table tr,
    table.data-table td {
        display: block;
        width: 100%;
    }

    table.data-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
    }

    table.data-table td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
        padding-left: 45%;
        position: relative;
        white-space: normal;
    }

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

    table.data-table td[data-label]::before {
        content: attr(data-label) ":";
        position: absolute;
        left: 0.6rem;
        width: 40%;
        text-align: left;
        font-weight: bold;
        white-space: nowrap;
    }

    table.data-table td[data-label=""]::before {
        content: none;
    }
}
