/* Кабінет власника платформи: світлий мінімалістичний мобільний інтерфейс. Без зовнішніх шрифтів. */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #0a66d8;
  --accent-text: #ffffff;
  --ok: #1f8a3b;
  --ok-bg: #e5f5ea;
  --warn: #9a5b00;
  --warn-bg: #fff1d6;
  --bad: #c42b1c;
  --bad-bg: #fde7e5;
  --radius: 16px;
  --gap: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 32px);
  min-height: 100vh;
}

h1 { font-size: 28px; line-height: 1.2; font-weight: 700; margin: 8px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; margin: 28px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 15px; }
.card .button + .muted { margin-top: 16px; }
.center { text-align: center; }

/* Верхній рядок: назад / заголовок / меню */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 4px;
}

.link {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  padding: 10px 0;
  min-height: 44px;
  cursor: pointer;
}

.icon-button {
  background: var(--card);
  border: 0;
  border-radius: 22px;
  width: 44px;
  height: 44px;
  font-size: 22px;
  line-height: 44px;
  color: var(--text);
  cursor: pointer;
}

/* Кнопки й поля: зони натискання не менші за 48 px */
.button {
  display: block;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 52px;
  margin: 12px 0 0;
  cursor: pointer;
}

.button.secondary { background: var(--card); color: var(--accent); }
.button.danger { background: var(--card); color: var(--bad); }
.button:disabled { opacity: 0.4; cursor: default; }

.field {
  display: block;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font: inherit;
  font-size: 24px;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 8px 12px;
  color: var(--text);
}

.field.wide { letter-spacing: 0.08em; font-size: 20px; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Картки */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 12px;
}

.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin: 0 0 12px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .sub { color: var(--muted); font-size: 14px; }

button.tenant {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.tenant-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tenant-name { font-weight: 600; font-size: 18px; }
.figures { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); font-size: 15px; }
.figures b { color: var(--text); font-weight: 600; }

/* Підсумки на головній */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 8px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* Мітки стану */
.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--line);
  color: var(--muted);
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }

/* Повідомлення */
.notice { border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; font-size: 15px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

/* Секрет і коди відновлення: моноширинно, без переносу посередині коду */
.secret {
  font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.06em;
  word-break: break-all;
  user-select: all;
}
.codes { display: grid; grid-template-columns: 1fr; gap: 10px; }
.codes li { list-style: none; font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace; font-size: 18px; letter-spacing: 0.04em; white-space: nowrap; }
.codes { padding: 0; margin: 0; }

.check { display: flex; gap: 12px; align-items: center; min-height: 52px; margin-top: 8px; font-size: 16px; }
.check input { width: 24px; height: 24px; flex: none; }

/* Стан завантаження */
.spinner {
  width: 32px; height: 32px; margin: 30vh auto 16px;
  border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Нижнє меню (вихід) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); display: flex; align-items: flex-end; z-index: 10; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); }

.hero { text-align: center; margin-top: 18vh; }
.hero .mark {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px;
  background: var(--accent); color: var(--accent-text); font-size: 28px; font-weight: 700; line-height: 64px;
}

@media (max-width: 360px) {
  html, body { font-size: 16px; }
  h1 { font-size: 24px; }
  .stat-value { font-size: 24px; }
  .codes li { font-size: 16px; }
}
