/* IVESTORE — кабинет клиента lk.ivestore.ru. Мобильный первым делом, работает и внутри Telegram WebApp. */
:root {
  --accent: #E5195F;
  --accent-dark: #C3104E;
  --accent-soft: #FDE7EF;
  --bg: #F4F4F7;
  --card: #FFFFFF;
  --text: #17171C;
  --muted: #7A7A86;
  --line: #ECECF1;
  --ok: #1F9D55;
  --warn: #E8A317;
  --bad: #D93025;
  --radius: 22px;
  --radius-sm: 14px;
  --nav-h: 68px;
  --shadow: 0 2px 12px rgba(23, 23, 28, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 8px; }

/* Шапка */
.c-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.c-header__logo { width: 36px; height: 36px; object-fit: contain; }
.c-header__who { flex: 1; min-width: 0; }
.c-header__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-header__sub { font-size: 13px; color: var(--muted); }
.c-header__back { color: var(--text); padding: 4px 4px 4px 0; display: flex; }
.c-header__action { background: none; border: 0; padding: 8px; color: var(--muted); cursor: pointer; display: flex; }
.is-telegram .c-header { display: none; }

/* Контент */
.c-main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.c-main--no-nav { padding-bottom: 32px; }
.c-title { margin: 4px 0 14px; }

.c-card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.c-card--accent { background: var(--accent); color: #fff; }
.c-card--accent a { color: #fff; }
.c-card--accent .c-muted { color: rgba(255, 255, 255, .8); }
.c-card--soft { background: var(--accent-soft); box-shadow: none; }
.c-muted { color: var(--muted); font-size: 13px; }
.c-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.c-big { font-size: 34px; font-weight: 700; line-height: 1.1; }
.c-list { list-style: none; margin: 0; padding: 0; }
.c-list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.c-list > li:last-child { border-bottom: 0; }
.c-list a { color: inherit; }
.c-amount--plus { color: var(--ok); font-weight: 600; }
.c-amount--minus { color: var(--bad); font-weight: 600; }
.c-pre { white-space: pre-line; }

.c-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.c-tile { display: flex; flex-direction: column; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: var(--text); min-height: 96px; }
.c-tile__icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.c-tile__label { font-weight: 600; }

.c-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.c-stat { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.c-stat__value { font-size: 28px; font-weight: 700; color: var(--accent); }

/* Кнопки и формы */
.c-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 14px 18px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.c-btn:active { background: var(--accent-dark); }
.c-btn--ghost { background: var(--accent-soft); color: var(--accent); }
.c-btn--plain { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.c-btn--white { background: #fff; color: var(--accent); }
.c-btn--small { width: auto; min-height: 38px; padding: 8px 14px; font-size: 14px; }
.c-btn[disabled] { opacity: .5; }
.c-btn + .c-btn { margin-top: 10px; }
.c-field { display: block; margin-bottom: 14px; }
.c-field__label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.c-input, .c-select, .c-textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font: inherit; color: var(--text);
}
.c-input[readonly] { background: var(--bg); color: var(--muted); }
.c-input--code { font-size: 26px; letter-spacing: 8px; text-align: center; font-weight: 600; }
.c-textarea { min-height: 120px; resize: vertical; }
.c-input:focus, .c-select:focus, .c-textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.c-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; font-size: 14px; }
.c-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.c-radios { display: flex; gap: 10px; }
.c-radios label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.c-error { color: var(--bad); font-size: 13px; margin-top: 6px; }
.c-flash { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-dark); margin-bottom: 12px; }
.c-flash--bad { background: #FCE5E3; color: var(--bad); }

.c-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--text); white-space: nowrap; }
.c-badge--ok { background: #E3F5EA; color: var(--ok); }
.c-badge--warn { background: #FDF3DC; color: #9A6A00; }
.c-badge--bad { background: #FCE5E3; color: var(--bad); }
.c-badge--accent { background: var(--accent-soft); color: var(--accent); }

.c-qr { display: block; width: 200px; height: 200px; margin: 8px auto 12px; }
.c-copy { display: flex; gap: 8px; }
.c-copy .c-input { flex: 1; min-width: 0; font-size: 14px; }

.c-pager { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }

/* Нижняя навигация */
.c-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px 4px env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.c-nav__item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.c-nav__item.is-active { color: var(--accent); }

/* Вход */
.c-auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 0; max-width: 420px; margin: 0 auto; }
.c-auth__logo { display: block; width: 200px; max-width: 70%; margin: 0 auto 28px; }
.c-center { text-align: center; }
.c-spinner { width: 36px; height: 36px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; margin: 16px auto; animation: c-spin 1s linear infinite; }
@keyframes c-spin { to { transform: rotate(360deg); } }

/* Карта по QR */
.c-loyalty-card { background: linear-gradient(135deg, var(--accent), #8E0F3D); color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 12px; box-shadow: 0 8px 24px rgba(229, 25, 95, .25); }
.c-loyalty-card .c-muted { color: rgba(255, 255, 255, .8); }
