/* Sondera Field: one page for the phone first, light and dark after the system. */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d232b;
    --muted: #5d6875;
    --border: #d9dee5;
    --accent: #1f6feb;
    --accent-text: #ffffff;
    --error: #b42318;
    --ok: #15803d;
    --pending: #b45309;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111418;
        --surface: #1b2027;
        --text: #e6e9ee;
        --muted: #9aa5b1;
        --border: #2e3640;
        --accent: #4c8dff;
        --error: #f97066;
        --ok: #4ade80;
        --pending: #fbbf24;
    }
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

.muted { color: var(--muted); }
.error { color: var(--error); }
[hidden] { display: none !important; }

button, .button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button, .button {
    display: inline-block;
    min-height: 44px;
    padding: .55rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    text-decoration: none;
    cursor: pointer;
}

button.primary, .button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}

button.link {
    min-height: 0;
    border: 0;
    padding: .2rem .4rem;
    background: none;
    color: var(--accent);
}

button:disabled { opacity: .6; cursor: default; }

input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

textarea { min-height: 5rem; resize: vertical; }

label { display: block; margin: .75rem 0 .25rem; font-weight: 600; }

.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: auto; min-height: 0; }

/* The PIN page and the signed-out page. */
.narrow { display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; }
.card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}
.card button[type=submit] { width: 100%; margin-top: 1rem; }

/* The app: bar, tabs, the tab's content and a sheet over it. */
#app { display: flex; flex-direction: column; height: 100%; }

.bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .5rem .9rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.bar .title { display: flex; flex-direction: column; min-width: 0; }
.bar .title strong, .bar .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .who { display: flex; align-items: center; gap: .25rem; white-space: nowrap; }

.tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
    flex: 1;
    border: 0;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    background: none;
    white-space: nowrap;
}
.tabs button[aria-selected=true] { border-bottom-color: var(--accent); font-weight: 600; }

.tab { flex: 1; min-height: 0; overflow: auto; padding: .75rem; position: relative; }
#tab-map { padding: 0; }
#map { position: absolute; inset: 0; }

.map-buttons {
    position: absolute;
    right: .75rem;
    bottom: 1.5rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.map-buttons button { box-shadow: 0 1px 4px rgb(0 0 0 / .25); }

.map-note {
    position: absolute;
    left: .75rem;
    bottom: 1.5rem;
    z-index: 500;
    max-width: 55%;
    margin: 0;
    padding: .4rem .6rem;
    border-radius: 6px;
    background: var(--surface);
    font-size: .875rem;
}

.leaflet-tooltip.label {
    padding: 0 4px;
    border: 0;
    box-shadow: none;
    background: rgb(255 255 255 / .85);
    color: #1d232b;
    font-weight: 600;
}
.leaflet-tooltip.label::before { display: none; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--border); }
.list .row {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: .6rem;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: none;
    text-align: left;
}
.list .row .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.Executed { background: #1f6feb; }
.dot.Planned { background: #d97706; }
.dot.Digitised { background: #8b5e3c; }
.dot.Proposed { background: #16a34a; }

.change { display: flex; flex-wrap: wrap; gap: .25rem .6rem; padding: .6rem 0; }
.change .comment { flex-basis: 100%; }
.status { font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.status.Pending { color: var(--pending); }
.status.Accepted { color: var(--ok); }
.status.Rejected { color: var(--error); }

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    max-height: 85%;
    overflow: auto;
    padding: 1rem 1rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 16px rgb(0 0 0 / .2);
}
@media (min-width: 800px) {
    .sheet { left: auto; top: 0; width: 420px; max-height: none; border-radius: 0; border-left: 1px solid var(--border); }
}
.sheet .close { position: absolute; right: .5rem; top: .25rem; font-size: 1.6rem; }
.sheet form button[type=submit] { width: 100%; margin-top: 1rem; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .9rem; margin: 0 0 .75rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.notice { padding: .5rem .7rem; border-radius: 8px; background: var(--bg); margin: .5rem 0; }

.foot { padding: .35rem .9rem; font-size: .8rem; background: var(--surface); border-top: 1px solid var(--border); }

.methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .25rem .75rem; }

.outbox {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem .9rem;
    background: var(--pending);
    color: #1d232b;
    font-weight: 600;
}
.outbox button.link { color: #1d232b; text-decoration: underline; }

.placing {
    position: absolute;
    left: 3.5rem;
    right: .75rem;
    top: .75rem;
    z-index: 600;
    padding: .6rem .75rem;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 2px 8px rgb(0 0 0 / .25);
}
.placing .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }

@media (max-width: 799px) {
    .sheet { max-height: 62%; }
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

.change img.thumb { display: block; max-width: 100%; max-height: 160px; margin-top: .3rem; border-radius: 6px; }
