/* fatum web: the same look as the mobile app, light and dark */
:root {
    color-scheme: light dark;
    --bg: #fafafa;
    --card: #fff;
    --text: #1c1b1f;
    --muted: #625b71;
    --line: #e0e0e0;
    --primary: #4f46e5;
    --on-primary: #fff;
    --ok: #1b5e20;
    --ok-bg: #e8f5e9;
    --bad: #b00020;
    --bad-bg: #fdecea;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --card: #1e1e1e;
        --text: #e6e1e5;
        --muted: #a8a2b0;
        --line: #333;
        --primary: #a5b4fc;
        --on-primary: #1e1b4b;
        --ok: #a5d6a7;
        --ok-bg: #1b2e1c;
        --bad: #ef9a9a;
        --bad-bg: #3b1d1d;
    }
}

* { box-sizing: border-box; }

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

header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

nav {
    display: flex;
    gap: 1.25em;
    align-items: center;
    max-width: 40em;
    margin: 0 auto;
    padding: .75em 1em;
    overflow-x: auto;
}

nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
nav a.on { color: var(--primary); font-weight: 600; }
nav a.logo { color: var(--text); font-weight: 700; margin-right: auto; display: flex; align-items: center; gap: .4em; }
nav a.logo img { display: block; }
/* the logo above the sign-in and sign-up forms; its own dark background */
.hero { display: block; width: calc(100% - 2em); max-width: 20em; height: auto; margin: 1.5em auto 0; border-radius: 12px; }
nav a:last-child { margin-left: auto; }

main, .message, .error {
    max-width: 40em;
    margin: 0 auto;
    padding: 0 1em;
}

main { padding-bottom: 3em; }
h1 { font-size: 1.5em; margin: 1em 0 .5em; }
h2 { font-size: 1.1em; margin: 1.25em 0 .25em; }
small { display: block; color: var(--muted); }
a { color: var(--primary); }

.message, .error {
    width: calc(100% - 2em);
    max-width: 38em;
    margin-top: 1em;
    padding: .75em 1em;
    border-radius: 8px;
}
.message { background: var(--ok-bg); color: var(--ok); }
.error { background: var(--bad-bg); color: var(--bad); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .9em 1em;
    margin: .6em 0;
}

.row { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
.price { font-size: 1.35em; }
.status { color: var(--primary); }
.empty { color: var(--muted); }

.tabs { display: flex; gap: .5em; margin-bottom: .5em; }
.tabs a {
    padding: .3em .9em;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}
.tabs a.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.actions { display: flex; flex-wrap: wrap; gap: .5em; margin-top: .5em; }
.actions details[open] { flex-basis: 100%; }

details { margin-top: .5em; }
/* a form of its own before the tabs: a gap below */
details.block { margin-bottom: 1.25em; }
details > summary { list-style: none; display: inline-block; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { opacity: .6; }

form { display: flex; flex-direction: column; gap: .6em; margin-top: .6em; }
form p { margin: 0; }
label { display: flex; flex-direction: column; gap: .25em; color: var(--muted); font-size: .9em; }

input, select, textarea {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .55em .7em;
}

label[hidden], input[hidden] { display: none; }
label.check { flex-direction: row; align-items: center; gap: .5em; color: var(--text); font-size: 1em; }
label.check input { margin: 0; }
form.filter { flex-direction: row; flex-wrap: wrap; align-items: center; margin: 0 0 .75em; }
form.filter select { flex: 1; min-width: 12em; }
form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
form.inline input { flex: 1; min-width: 8em; }
.ways { display: flex; flex-wrap: wrap; gap: .35em; margin-top: .35em; align-items: baseline; }
.way { font-size: .85em; padding: .1em .55em; border-radius: 10px; border: 1px solid var(--line); }
.way.off { color: var(--muted); text-decoration: line-through; }
.methods { list-style: none; padding: 0; margin: .5em 0 0; }
.methods li { display: flex; justify-content: space-between; align-items: center; gap: .75em;
    padding: .35em 0; border-top: 1px solid var(--line); }
.methods li form { margin: 0; }

input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

button, .button {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    padding: .5em 1.1em;
    border-radius: 20px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--on-primary);
    text-decoration: none;
}

button.outline, .button.outline { background: transparent; color: var(--primary); }
button.text { background: transparent; border-color: transparent; color: var(--primary); padding-left: 0; }
button.danger { background: var(--bad); border-color: var(--bad); color: var(--card); }

/* htmx is at work: a link or a form waits for the server */
.htmx-request button, button.htmx-request, form.htmx-request button { opacity: .5; pointer-events: none; }

/* a window over the page, without scripts: the requisites of a deposit request */
dialog.window {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(32em, calc(100% - 2em));
    max-height: calc(100% - 2em);
    height: fit-content;
    overflow: auto;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1em 1.2em;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5);
    z-index: 10;
}
dialog.window h2 { margin-top: 0; }
.details { white-space: pre-wrap; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
textarea { resize: vertical; }
/* the debugging error page: the stack trace */
pre.trace { font-size: .75em; overflow: auto; max-height: 70vh; white-space: pre; }
