:root {
  --bg: #f3f5f8;
  --card: #fff;
  --ink: #17283d;
  --muted: #52647a;
  --line: #d9e1ea;
  --blue: #174fc4;
  --green: #166342;
  --green-bg: #e7f5ed;
  --amber: #794900;
  --amber-bg: #fff3d9;
  --red: #a32232;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea { max-width: 100%; }
button {
  min-width: 44px;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
}
button:disabled { cursor: not-allowed; opacity: .65; }
:focus-visible { outline: 3px solid #ed9b00; outline-offset: 3px; }
.shell {
  max-width: 740px;
  margin: auto;
  padding: 16px 16px calc(112px + env(safe-area-inset-bottom));
}
header, .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
header { margin-bottom: 20px; }
.row { flex-wrap: wrap; }
.row > *, .grid2 > *, .automaty-grid > * { min-width: 0; }
.brand { font-weight: 850; letter-spacing: .08em; font-size: 19px; }
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 750;
}
h1 { font-size: 27px; line-height: 1.2; margin: 6px 0 16px; }
h2 { font-size: 20px; line-height: 1.3; margin: 0 0 12px; }
h3 { font-size: 17px; margin: 0; }
p { margin: 8px 0 12px; }
small, .muted { color: var(--muted); }
small { font-size: 13px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
}
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.full { width: 100%; margin-top: 12px; }
.badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
  background: #edf1f6;
  color: #42546b;
}
.good { background: var(--green-bg); color: var(--green); }
.warn, .notice { background: var(--amber-bg); color: var(--amber); }
.notice { border-left: 4px solid #c68411; padding: 13px 15px; border-radius: 10px; }
.error { color: var(--red); }
.tabs, .actions, .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.tabs button, .actions button { flex: 1; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: white; }
label { display: block; font-weight: 650; margin: 12px 0 6px; }
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px;
  border: 1px solid #aebccc;
  border-radius: 11px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 220px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 15px; border: 1px solid var(--line); border-radius: 13px; }
.metric strong { display: block; font-size: 26px; line-height: 1.2; }
.metric span { font-size: 13px; color: var(--muted); }
.switch {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  height: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0;
}
.switch::before {
  content: "";
  position: absolute;
  inset: 7px 0;
  border-radius: 30px;
  background: #8492a5;
}
.switch::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
}
.switch[aria-checked="true"]::before { background: var(--green); }
.switch[aria-checked="true"]::after { left: 30px; }
.preview, .diff { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border-radius: 12px; }
.preview { background: #f2f6fc; border: 1px solid #dbe5f3; }
.before { background: #fff1f1; }
.after { background: #eaf6ef; }
.entry { padding: 14px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
details summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 650; }
.counter { text-align: right; font-size: 13px; }
.login { max-width: 420px; margin: 28px auto; }
#message:not(:empty) {
  position: sticky;
  bottom: 88px;
  z-index: 6;
  padding: 14px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: 0 8px 35px #17283d33;
}
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  background: white;
  border-top: 1px solid var(--line);
  padding: 8px 5px calc(8px + env(safe-area-inset-bottom));
}
.nav-inner { max-width: 740px; margin: auto; display: flex; gap: 3px; }
nav button {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 6px 2px;
  border: 0;
  font-size: 12px;
  color: var(--muted);
}
nav button[aria-current="page"] { background: #eaf0ff; color: var(--blue); }
@media (min-width: 650px) {
  .automaty-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .automaty-grid .card { margin: 0; }
  .shell { padding-top: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .switch::after { transition: left .15s; }
}
