/* eve-login: mobile-first (320 px až desktop), velká tlačítka, bez frameworku. */
:root {
  --brand: #3c9698;
  --brand-dark: #2c7678;
  --brand-soft: #e6f2f2;
  --text: #1d2b2c;
  --muted: #5b6b6c;
  --bg: #f3f7f7;
  --card: #ffffff;
  --line: #d6e2e2;
  --error: #b42318;
  --error-bg: #fef3f2;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #93370d;
  --warn-bg: #fffaeb;
  --radius: 14px;
  --on-brand: #ffffff;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5fb6b8;
    --brand-dark: #86cacb;
    --brand-soft: #1d3434;
    --text: #e8f0f0;
    --muted: #a3b4b5;
    --bg: #0f1919;
    --card: #172424;
    --line: #2b3d3d;
    --error: #fda29b;
    --error-bg: #3b1714;
    --ok: #75e0a7;
    --ok-bg: #0f2b1d;
    --warn: #fec84b;
    --warn-bg: #33270a;
    --on-brand: #0b1616;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
}

.page {
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  max-width: 460px;
}
body.wide .page { max-width: 1180px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 16px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .2px;
}
.brand img { border-radius: 50%; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px 24px;
  box-shadow: 0 1px 2px rgba(16, 40, 40, .05);
}
@media (min-width: 480px) { .card { padding: 30px 30px 32px; } }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
p { margin: 0 0 14px; }
a { color: var(--brand-dark); }
.lead { font-size: 17px; color: var(--text); }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.center { text-align: center; }
.target { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; }

.stack { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
label { font-weight: 600; }

input, select, button { font: inherit; }

input[type="email"], input[type="text"], input[type="date"], input:not([type]), select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font-size: 18px; /* ≥16 px: iOS nezoomuje */
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
}
input:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[readonly] { background: var(--bg); }

input.code {
  font-size: 30px;
  letter-spacing: .35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding-left: calc(14px + .35em);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-weight: 650;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  touch-action: manipulation;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.secondary { border-color: var(--brand); color: var(--brand-dark); }
.btn.danger { border-color: var(--error); color: var(--error); background: transparent; }
.btn.link { border: 0; background: transparent; color: var(--brand-dark); text-decoration: underline; min-height: 44px; }
.btn[disabled] { opacity: .55; cursor: default; text-decoration: none; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; width: auto; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

.alert { border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-weight: 500; }
.alert.error { background: var(--error-bg); color: var(--error); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--brand-soft); }

fieldset { border: 0; padding: 0; margin: 8px 0 4px; }
legend { font-weight: 600; margin-bottom: 8px; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-weight: 400;
  cursor: pointer;
}
.choice input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-size: 14px; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.resend { margin-top: 6px; }

.devices-list { list-style: none; padding: 0; margin: 0 0 18px; }
.device {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.device-info { display: flex; flex-direction: column; min-width: 0; }
.device-info small { color: var(--muted); }
.device-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand-dark);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--error-bg); color: var(--error); }

form.inline { display: inline; }

/* ---------- admin ---------- */
.admin-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between; }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 18px; padding-bottom: 4px; }
.admin-nav a {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
}
.admin-nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions form + form { margin-left: 6px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 8px 0 8px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); }
.stat strong { font-size: 26px; }
.stat span { color: var(--muted); font-size: 14px; }
.stat.warn { border-color: var(--warn); background: var(--warn-bg); }

.row-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.row-form input, .row-form select { flex: 1 1 220px; width: auto; min-height: 44px; font-size: 16px; }
.row-form .btn { width: auto; min-height: 44px; }

.grid-form { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
@media (min-width: 760px) { .grid-form { grid-template-columns: 1fr 1fr; } .grid-form .span2, .grid-form fieldset { grid-column: span 2; } }
.grid-form label { display: flex; flex-direction: column; gap: 4px; }
.grid-form small { font-weight: 400; }
body.wide .btn { width: auto; }
details.add { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0 18px; }
details.add summary { cursor: pointer; font-weight: 650; font-size: 17px; min-height: 28px; }
details.add[open] summary { margin-bottom: 12px; }
.grid-form input, .grid-form select { min-height: 44px; font-size: 16px; }
.grid-form .btn { width: auto; }
.perms { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.perms legend { width: 100%; }
.perms label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.perms label:not(.check) { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
