:root {
    color-scheme: light;
    --ink: #243027;
    --muted: #647067;
    --line: #d9dfd4;
    --panel: #ffffff;
    --soft: #f4f7ef;
    --accent: #8b3f24;
    --accent2: #2f6b4f;
    --gold: #d9a441;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: #eef3e7;
}

a {
    color: var(--accent2);
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 22px;
    background: #fff8df;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

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

.brand-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.test-note {
    color: #8a331c;
    font-size: 13px;
    font-weight: 700;
    max-width: 360px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

nav a,
.button,
button {
    border: 1px solid var(--accent2);
    background: var(--accent2);
    color: white;
    padding: 8px 11px;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}

main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 20px;
    align-items: start;
}

.layout.events-focused {
    grid-template-columns: 330px minmax(0, 1fr);
}

.public-layout {
    grid-template-columns: minmax(0, 1fr) 28px 340px;
}

.public-layout.search-focused {
    grid-template-columns: minmax(0, 1fr) 28px 250px;
}

.public-layout.events-focused {
    grid-template-columns: 300px 28px minmax(0, 1fr);
}

.layout-divider {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    min-height: 320px;
}

.layout-divider a {
    background: #dbe7d2;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--accent2);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    text-decoration: none;
}

.search-panel,
aside,
.narrow,
.provider,
.event,
.card,
form {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.search-panel,
aside,
.narrow {
    padding: 16px;
}

h1 {
    margin: 0 0 14px;
    font-size: 28px;
}

h2 {
    margin: 0 0 8px;
    font-size: 19px;
}

.search {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) auto;
    gap: 10px;
    padding: 12px;
    background: var(--soft);
    margin-bottom: 14px;
}

.search-wide {
    grid-template-columns: minmax(170px, 240px) minmax(260px, 1fr) auto;
}

.service-picker {
    max-height: 150px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 2px 8px;
}

.service-picker label {
    margin: 0;
    color: var(--ink);
}

.service-picker input {
    width: auto;
}

input,
select,
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #b8c4b6;
    border-radius: 4px;
    font: inherit;
    background: white;
}

textarea {
    min-height: 90px;
}

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
}

label input,
label select,
label textarea {
    margin-top: 4px;
    color: var(--ink);
}

.provider-list {
    display: grid;
    gap: 10px;
}

.provider,
.event {
    padding: 12px;
}

.provider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 10px;
    min-height: 120px;
}

.provider-location {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.region-codes {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.provider-media {
    display: flex;
    min-height: 96px;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}

.ubai-logo {
    max-width: 86px;
    max-height: 48px;
    object-fit: contain;
}

.favicon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: -2px;
}

.provider-logo,
.provider-preview {
    max-width: 86px;
    max-height: 72px;
    object-fit: contain;
}

.provider-preview {
    display: block;
    border: 1px solid var(--line);
    background: white;
}

.provider h2 span {
    font-size: 12px;
    color: #4e3100;
    background: #ffe08a;
    padding: 2px 5px;
    border-radius: 3px;
}

.event {
    margin-bottom: 10px;
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.pager a {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px 10px;
    text-decoration: none;
}

.event-filter {
    padding: 8px;
    margin-bottom: 12px;
}

.event-filter label {
    display: block;
    color: var(--ink);
    margin-bottom: 5px;
}

.event-filter input {
    width: auto;
}

.event time {
    display: block;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 4px;
}

.event-cost {
    font-size: 12px;
    color: var(--muted);
}

.narrow {
    max-width: 520px;
}

.narrow form,
.provider-form {
    border: 0;
    padding: 0;
}

.provider-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.wide,
fieldset,
.provider-form button {
    grid-column: 1 / -1;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

.check {
    display: inline-block;
    width: 240px;
    margin-right: 8px;
    color: var(--ink);
}

.check input {
    width: auto;
}

.service-help {
    cursor: help;
}

.service-help-popup {
    background: #fffdf3;
    border: 1px solid #cdbb84;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(37, 48, 39, .18);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
    max-height: min(420px, calc(100vh - 20px));
    max-width: 320px;
    overflow: auto;
    padding: 10px 12px;
    pointer-events: none;
    position: fixed;
    z-index: 2147483647;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.card {
    padding: 18px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

.flash {
    max-width: 1180px;
    margin: 12px auto 0;
    padding: 10px 14px;
    background: #fff2bd;
    border: 1px solid #e2c35f;
    border-radius: 6px;
}

.empty {
    color: var(--muted);
}

.admin-row {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
}

.inline {
    display: inline-block;
    border: 0;
    margin: 4px 4px 0 0;
    padding: 0;
    background: transparent;
}

.inline button {
    font-size: 12px;
    padding: 4px 7px;
}

footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 30px;
    padding: 18px;
    background: #263428;
    color: white;
}

footer a {
    color: white;
}

@media (max-width: 820px) {
    .top,
    .layout,
    .search,
    .provider-form {
        display: block;
    }

    .layout-divider {
        display: none;
    }

    nav {
        margin-top: 10px;
    }

    .search > * {
        margin-bottom: 8px;
    }

    aside {
        margin-top: 16px;
    }

    .provider {
        grid-template-columns: minmax(0, 1fr) 78px;
    }

    .check {
        width: 100%;
    }
}
