/* Go Play Content — мини-апп. Белый, мягкий, эппловский. */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --accent: #0a84ff;
  --accent-soft: #eaf3ff;
  --green: #30d158;
  --green-soft: #eafbef;
  --orange: #ff9f0a;
  --orange-soft: #fff4e5;
  --red: #ff3b30;
  --line: #e8e8ed;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── шапка ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 12px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.app-title { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.app-sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.role-chip {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 10px; border-radius: 999px;
}

/* ── контент ── */
.view {
  flex: 1; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 86px);
  max-width: 640px; width: 100%; margin: 0 auto;
  animation: fadein .18s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); margin: 22px 4px 8px;
}
.section-title:first-child { margin-top: 4px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card + .card { margin-top: 10px; }

/* статы */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.stat .lbl { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* график */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 8px 2px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .bar-click { background: var(--accent); border-radius: 3px 3px 2px 2px; min-height: 2px; }
.chart .bar-start { background: var(--green); border-radius: 3px 3px 2px 2px; min-height: 0; }
.chart-days { display: flex; gap: 4px; margin-top: 6px; }
.chart-days span { flex: 1; text-align: center; font-size: 9px; color: var(--text-3); overflow: hidden; }
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }

/* списки */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; padding-bottom: 2px; }
.row:first-child { padding-top: 2px; }
.row .main { min-width: 0; flex: 1; }
.row .title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; flex-shrink: 0; }
.row .num { font-weight: 700; font-size: 16px; }
.row .num-sub { font-size: 11px; color: var(--text-3); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.green { color: #1d9d47; background: var(--green-soft); }
.badge.orange { color: #c47a00; background: var(--orange-soft); }
.badge.blue { color: var(--accent); background: var(--accent-soft); }
.badge.gray { color: var(--text-2); background: var(--bg); }

/* кнопки */
.btn {
  display: block; width: 100%; border: none; cursor: pointer;
  background: var(--accent); color: #fff;
  font: 600 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 14px; border-radius: 14px; letter-spacing: -.01em;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); opacity: .9; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); padding: 10px; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.danger-ghost { background: transparent; color: var(--red); padding: 10px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { margin: 0; }

/* формы */
label.field { display: block; margin-bottom: 12px; }
label.field .cap { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: block; }
input[type=text], input[type=number], input[type=date], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--bg);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; color: var(--text);
  font-family: inherit; outline: none; transition: border-color .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: #fff; }
textarea { min-height: 110px; resize: vertical; }

.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: none; background: transparent; padding: 9px 6px;
  font: 600 13px/1 inherit; color: var(--text-2); border-radius: 10px; cursor: pointer;
  transition: all .15s;
}
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ссылки-карточки */
.linkbox {
  background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-top: 8px;
  display: flex; align-items: center; gap: 10px;
}
.linkbox .lk { flex: 1; min-width: 0; }
.linkbox .lk .t { font-size: 12px; font-weight: 600; color: var(--text-2); }
.linkbox .lk .u { font-size: 12.5px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* таббар */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 8px);
}
.tabbar button {
  border: none; background: none; cursor: pointer; flex: 1; max-width: 110px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font: 500 10.5px/1 inherit; color: var(--text-3); padding: 4px 0;
  transition: color .15s;
}
.tabbar button.on { color: var(--accent); }
.tabbar svg { width: 23px; height: 23px; }

/* тост и шторка */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  transform: translateX(-50%); z-index: 60;
  background: rgba(29,29,31,.92); color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: fadein .2s ease;
}
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40;
  animation: fadein .2s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  max-height: 82dvh; overflow-y: auto;
  animation: sheetup .22s cubic-bezier(.3,1.1,.4,1);
}
@keyframes sheetup { from { transform: translateY(40%); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet .grip { width: 38px; height: 4px; background: var(--line); border-radius: 2px; margin: 4px auto 14px; }
.sheet h3 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; }

.empty { text-align: center; color: var(--text-3); padding: 36px 20px; font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }

.spinner {
  width: 26px; height: 26px; margin: 40px auto; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice { font-size: 13px; color: var(--text-2); background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
