/* Внутренние страницы (вход, кабинет, оплата, документы) — та же система, что у главной (landing.css), но кабинет
   общий для приложений студии «Просто»: поэтому цвета и знак студии (как в studio/studio.css), а цвета приложения —
   только в карточке его подписки. */
:root {
  --mist: #f4f1ea; --surface: #ffffff; --ink: #18181d; --muted: #5b5a63; --line: #ddd8cc;
  --teal: #4c45d6;        /* ссылки и выбранное */
  --rasp: #4c45d6; --rasp-fill: #4c45d6; --rasp-soft: #8a84f0;
  --accent-soft: #e7e5fb; --sun: #f2c14e; --danger: #b3261e;
  --t-teal: #e7e5fb; --t-violet: #f7edd2;
}
@media (prefers-color-scheme: dark) {
  :root { --mist: #121215; --surface: #1c1c21; --ink: #ecebf0; --muted: #a4a3ae; --line: #2e2d35; --teal: #aaa5ff; --rasp: #aaa5ff; --rasp-soft: #aaa5ff;
    --accent-soft: #29274d; --sun: #d9a93a; --danger: #f2a7a0; --t-teal: #29274d; --t-violet: #2f2919; }
}

/* Шапка — светлая, как на странице студии; знак студии — квадрат с солнцем */
.top { background: var(--mist); color: var(--ink); border-bottom: 1px solid var(--line); }
.top .nav a { color: var(--muted); }
.top .nav a:hover { color: var(--ink); }
.top .nav-login { color: var(--ink); border-color: var(--line); }
.top .nav-login:hover { color: var(--ink); border-color: var(--ink); background-color: transparent; }
.brand { gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.mark { display: block; position: relative; flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--ink); }
.mark::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--sun);
  transition: transform .45s cubic-bezier(.3, .7, .2, 1.2); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) { .brand:hover .mark::after { transform: translate(-9px, -9px); } }
.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }


body { display: flex; flex-direction: column; min-height: 100vh; }
main.inner { width: min(1040px, 100% - 32px); margin: 0 auto; padding: 36px 0 64px; flex: 1; }
main.inner h1 { font: 700 clamp(26px, 3.6vw, 36px)/1.12 var(--display); letter-spacing: -0.02em; margin: 0 0 10px; max-width: none; }
main.inner h2 { font: 600 20px/1.3 var(--display); letter-spacing: -0.01em; margin: 32px 0 14px; }
main.inner a { color: var(--teal); }
.small { font-size: 14px; }
.flash { border-radius: 14px; padding: 12px 16px; margin: 0 0 16px; font-size: 15px; }
.flash.ok { background: #e3f2e5; color: #1b5e20; }
.flash.err { background: #fce4ec; color: #8a1240; }
@media (prefers-color-scheme: dark) { .flash.ok { background: #173323; color: #a5d6a7; } .flash.err { background: #3a1a28; color: #f8bbd0; } }

/* Поля и кнопки */
label { display: block; margin: 12px 0 6px; font-weight: 500; }
input[type=email], input[type=text] { width: 100%; max-width: 420px; min-height: 54px; padding: 0 18px; font: 400 17px var(--text); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; transition: border-color .15s, box-shadow .15s; }
input[type=email]:focus, input[type=text]:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--rasp); flex: none; margin: 2px 0 0; }
main.inner button { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--rasp-fill); color: #fff; font: 600 16px/1 var(--text); cursor: pointer; transition: transform .15s, background .15s; }
main.inner button:hover { background: #3a33b8; transform: translateY(-1px); }
main.inner button:active { transform: translateY(1px) scale(.98); transition-duration: .08s; }
main.inner button.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
main.inner button.secondary:hover { box-shadow: inset 0 0 0 1px var(--muted); background: transparent; }
main.inner button.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
main.inner button.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
main.inner button.ghost { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); min-height: 44px; font-size: 15px; }
main.inner button.ghost:hover { background: rgba(255, 255, 255, .2); }

/* Вход */
.auth { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); border-radius: 28px; overflow: hidden; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 30px 60px -40px rgba(14, 42, 51, .45); }
.auth-side { position: relative; isolation: isolate; overflow: hidden; background: linear-gradient(160deg, #1d1c24 0%, #25233f 100%); color: #ecebf0; padding: 36px 32px; }
.mark.big { width: 56px; height: 56px; border-radius: 18px; background: #f4f1ea; }
.mark.big::after { right: 10px; bottom: 10px; width: 18px; height: 18px; background: #f2c14e; }
.auth-side h2 { color: #fff; margin: 18px 0 18px !important; }
.auth-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.auth-side li { display: grid; grid-template-columns: 26px 1fr; gap: 14px; align-items: start; color: #c9c8d3; font-size: 15px; }
.auth-side li .i { width: 24px; height: 24px; color: #f2c14e; }
.auth-main { padding: 36px 40px 40px; }
.steps { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 14px; color: var(--muted); }
.steps span.on { color: var(--rasp); font-weight: 600; }
.steps span.done { color: var(--teal); }
.steps .line { flex: 0 0 40px; height: 2px; background: var(--line); }
.auth-form { display: flex; flex-direction: column; align-items: stretch; max-width: 420px; gap: 4px; margin: 8px 0 12px; }
.auth-form button { margin-top: 14px; }
input.code { font: 600 30px/1 var(--mono); letter-spacing: .45em; text-align: center; max-width: 320px; padding: 0 0 0 .45em; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; } .auth-side { padding: 26px 22px; } .auth-main { padding: 26px 22px 30px; } }

/* Кабинет: карточка статуса */
.status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 22px 32px; border-radius: 28px; padding: 28px 30px; color: var(--on-deep);
  --app-a: #26244a; --app-b: #4c45d6; position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(135deg, var(--app-a) 0%, color-mix(in srgb, var(--app-a) 72%, var(--app-b)) 130%); box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .6); }
/* Цвета приложения — как в его карточке на странице студии */
.status.app-myfinance { --app-a: #1f3f4a; --app-b: #d81b60; }
.status.app-splitbill { --app-a: #1f4e79; --app-b: #d13c0c; }
.status.premium { background: linear-gradient(135deg, var(--app-a) 0%, var(--app-a) 35%, color-mix(in srgb, var(--app-a) 40%, var(--app-b)) 120%); }
.status-main { display: flex; gap: 18px; align-items: flex-start; flex: 1 1 420px; }
.status-main img { flex: none; border-radius: 16px; width: 56px; height: 56px; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6); }
.status h1 { color: #fff; margin: 2px 0 6px !important; }
.status-kicker { color: var(--on-deep-muted); font-size: 14px; margin: 0; }
.status-sub { color: #e6f1f3; margin: 0 0 12px; max-width: 34rem; }
.status-note { color: var(--on-deep-muted); font-size: 14px; margin: 6px 0 0; }
.status-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex: 0 1 300px; }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.chip.on { background: rgba(129, 199, 132, .2); color: #c8e6c9; }
.chip.off { background: rgba(255, 255, 255, .12); color: #e6f1f3; }
meter.left { width: min(360px, 100%); height: 10px; display: block; margin-top: 4px; }
meter.left::-webkit-meter-bar { background: rgba(255, 255, 255, .15); border: 0; border-radius: 999px; }
meter.left::-webkit-meter-optimum-value, meter.left::-webkit-meter-suboptimum-value { background: linear-gradient(90deg, #f2c14e, #ffe08a); border-radius: 999px; }
meter.left::-moz-meter-bar { background: linear-gradient(90deg, #f2c14e, #ffe08a); border-radius: 999px; }

/* Кабинет: тарифы (как на главной, с согласием) */
main.inner .plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
main.inner .plan { display: flex; flex-direction: column; gap: 4px; padding: 22px 24px; border-radius: 24px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
main.inner .plan-best { box-shadow: inset 0 0 0 2px var(--rasp); background: linear-gradient(160deg, var(--surface) 0%, var(--surface) 55%, var(--accent-soft) 100%); }
@media (hover: hover) { main.inner .plan-best:hover { box-shadow: inset 0 0 0 2px var(--rasp), 0 20px 36px -22px color-mix(in srgb, var(--rasp) 60%, transparent); } }
main.inner .plan button { margin-top: 12px; align-self: flex-start; }
label.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 10px; }

/* Кабинет: карточки */
.lk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 24px; align-items: start; }
.lk-card { background: var(--surface); border-radius: 24px; padding: 20px 22px; box-shadow: inset 0 0 0 1px var(--line); }
.lk-card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px !important; font-size: 18px !important; }
.lk-card h2 .i { width: 22px; height: 22px; color: var(--teal); }
.lk-card.account { margin-top: 16px; }
.lk-card .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.device { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 14px; background: var(--mist); margin-bottom: 10px; }
table.pays { width: 100%; border-collapse: collapse; }
table.pays td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.pays tr:last-child td { border-bottom: 0; }
table.pays td strong { display: block; font-weight: 600; }
table.pays td.amount { text-align: right; padding-right: 12px; font-weight: 600; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.pill.succeeded { background: #e3f2e5; color: #1b5e20; }
.pill.canceled { background: #fce4ec; color: #8a1240; }
.pill.refunded { background: #fff3e0; color: #8a4b00; }
.pill.pending, .pill.created { background: var(--mist); color: var(--muted); }
@media (prefers-color-scheme: dark) { .pill.succeeded { background: #173323; color: #a5d6a7; } .pill.canceled { background: #3a1a28; color: #f8bbd0; } .pill.refunded { background: #35241a; color: #ffcc80; } }
details.delete { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.delete summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details.delete form { margin-top: 12px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; color: var(--muted); }
details.transfer { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.transfer summary { cursor: pointer; color: var(--teal); font-weight: 600; font-size: 15px; }
details.transfer form { margin: 6px 0 16px; }
details.transfer label:not(.check) { font-size: 14px; color: var(--muted); margin-top: 8px; }
details.transfer label.check { margin: 14px 0; }
main.inner select { width: 100%; max-width: 420px; min-height: 54px; padding: 0 14px; font: 400 16px var(--text); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; }
.request { padding: 12px 14px; border-radius: 14px; background: #fff3e0; color: #5a3600; margin-top: 4px; }
.request strong { display: block; }
.request p { margin: 4px 0 10px; }
@media (prefers-color-scheme: dark) { .request { background: #35241a; color: #ffcc80; } }

/* Документы */
main.inner > p { max-width: 46rem; }

/* Отмена автопродления — с подтверждением, на тёмной карточке статуса */
details.cancel-renew summary { justify-content: flex-start; gap: 12px; padding: 6px 0; color: var(--on-deep-muted); font-size: 14px; font-weight: 500; }
details.cancel-renew form { margin-top: 10px; max-width: 300px; }
details.cancel-renew p { color: var(--on-deep-muted); margin: 0 0 8px; }
details.cancel-renew label.check { color: var(--on-deep); margin: 0 0 12px; }


/* Раскрывающиеся блоки кабинета: стрелка вниз — «раскрыть», при раскрытии переворачивается на месте */
main.inner summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
main.inner details[open] > summary::after { transform: translateY(2px) rotate(225deg); }
@media (prefers-reduced-motion: reduce) { main.inner summary::after { transition: none; } }

/* «Ещё N платежей» */
details.more-pays summary { padding: 12px 0 6px; font-size: 14px; color: var(--teal); border-top: 1px solid var(--line); }
details.more-pays table.pays { margin-top: 4px; }
/* Обе таблицы платежей (видимая и под «Ещё») — с одинаковыми столбцами */
table.pays td:nth-child(2) { width: 96px; }
table.pays td:nth-child(3) { width: 156px; }
details.cancel-renew { border: 0; }
.status + .flash { margin-top: 16px; }

/* Пробный период — над тарифами */
.trial-card { display: flex; gap: 18px; align-items: flex-start; margin-top: 20px; padding: 22px 24px; border-radius: 24px;
  background: linear-gradient(135deg, var(--t-teal) 0%, var(--t-violet) 100%); box-shadow: inset 0 0 0 1px var(--line); }
.trial-card > .i { flex: none; width: 48px; height: 48px; padding: 11px; border-radius: 14px; background: var(--surface); color: var(--teal); }
.trial-card h2 { margin: 0 0 6px !important; font-size: 20px !important; }
.trial-card p { margin: 0 0 12px; max-width: 40rem; }

/* Вкладки приложений в кабинете: значок, название и что сейчас (Premium, бесплатно, в разработке) */
.app-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.app-tab { display: grid; grid-template-columns: 28px auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 16px 10px 12px;
  border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); text-decoration: none; min-height: 48px; }
.app-tab img { grid-row: 1 / 3; border-radius: 8px; }
.app-tab-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.app-tab-state { color: var(--muted); font-size: 13px; line-height: 1.2; }
.app-tab:hover { box-shadow: inset 0 0 0 1px var(--teal); }
.app-tab.on { box-shadow: inset 0 0 0 2px var(--teal); }

/* --- Движение кабинета: только CSS, через transform и opacity; при «Уменьшить движение» — ничего --- */
@media (hover: hover) {
  .app-tab:hover { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: no-preference) {
  /* Страница собирается сверху вниз: сообщение, вкладки, статус, карточки */
  main.inner .flash { animation: drop-in .45s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes drop-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
  .app-tabs, .status, .trial-card, main.inner .plans, .lk-grid > *, .lk-card.account, .auth, main.inner > h1, main.inner > p {
    animation: rise-in .6s cubic-bezier(.2, .7, .2, 1) both;
  }
  .status { animation-delay: .06s; } .trial-card { animation-delay: .12s; } main.inner .plans { animation-delay: .16s; }
  .lk-grid > :nth-child(1) { animation-delay: .18s; } .lk-grid > :nth-child(2) { animation-delay: .24s; } .lk-card.account { animation-delay: .3s; }
  @keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

  /* Медленный свет на карточке статуса и на панели входа */
  .status::before, .auth-side::before { content: ""; position: absolute; z-index: -1; width: 420px; aspect-ratio: 1; right: -140px; top: -180px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .14), transparent); animation: drift 18s ease-in-out infinite alternate; }
  .auth-side::before { background: radial-gradient(closest-side, rgba(170, 165, 255, .22), transparent); right: auto; left: -160px; top: auto; bottom: -200px; }
  @keyframes drift { to { transform: translate(-120px, 90px) scale(1.2); } }

  /* Знак на странице входа: солнце медленно обходит квадрат */
  .mark.big::after { animation: orbit 12s ease-in-out 1s infinite; }
  @keyframes orbit {
    0%, 100% { transform: none; } 25% { transform: translate(0, -18px); } 50% { transform: translate(-18px, -18px); } 75% { transform: translate(-18px, 0); }
  }

  /* Пункты на панели входа появляются по очереди */
  .auth-side li { animation: rise-in .5s cubic-bezier(.2, .7, .2, 1) both; }
  .auth-side li:nth-child(1) { animation-delay: .2s; } .auth-side li:nth-child(2) { animation-delay: .3s; } .auth-side li:nth-child(3) { animation-delay: .4s; }
}
