:root {
  --bg: #0B0B0C;
  --surface: #151517;
  --text: #ECEAE6;
  --muted: #A19D96;
  --accent: #D8B98A;
  --line: #2A2A2E;
  --error: #F0A08C;
  --ok: #9CCB9A;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  padding: env(safe-area-inset-top) 0 calc(84px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  min-height: 56px;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}

main { padding: 0 16px; max-width: 560px; margin: 0 auto; }

h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 28px;
  margin: 8px 0 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

form.card, .done { display: flex; flex-direction: column; gap: 16px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--muted); flex: 1; }

input, select {
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 52px;
  padding: 12px 14px;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: var(--error); }

.row { display: flex; gap: 12px; }

button, .button {
  font: inherit;
  font-weight: 600;
  font-size: 18px;
  min-height: 56px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--accent);
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  touch-action: manipulation;
}

.primary { background: var(--accent); color: var(--bg); }
.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.55; }

.link {
  width: auto;
  min-height: 48px;
  min-width: 48px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  padding: 0 4px;
}

.err { color: var(--error); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.msg { color: var(--muted); margin: 0; }
.msg:empty { display: none; }
#login-msg, #termin-msg { color: var(--error); }

.done-title { font-family: var(--display); font-size: 20px; margin: 0; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.item p { margin: 0; }
.item .name { font-family: var(--display); font-size: 20px; font-weight: 600; }
.item .when { color: var(--accent); font-weight: 600; }
.item .meta { color: var(--muted); font-size: 15px; margin-top: 4px; }
.item .msg { margin-top: 10px; color: var(--error); }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.day { color: var(--muted); font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 8px; }

.badge-consent { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.badge-consent.ok { background: rgba(156, 203, 154, 0.15); color: var(--ok); }
.badge-consent.open { background: rgba(240, 160, 140, 0.15); color: var(--error); }
.pending { font-size: 14px; }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.tabs button {
  flex: 1;
  min-height: 56px;
  font-size: 15px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 12px;
  padding: 6px;
  gap: 6px;
}

.tabs button.active { color: var(--bg); background: var(--accent); }

.badge {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--error);
  color: var(--bg);
  padding: 0 6px;
}

@media (min-width: 700px) {
  .actions { flex-direction: row; }
}
