* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d0f12; --panel: #161a20; --panel2: #1e242c; --line: #2a313b;
  --text: #e8ecf1; --muted: #93a0af;
  --accent: #a3e635; --accent-ink: #10150a;
}
body[data-theme="lime"]   { --accent:#a3e635; --accent-ink:#131a06; }
body[data-theme="orange"] { --accent:#fb923c; --accent-ink:#1d1005; }
body[data-theme="violet"] { --accent:#a78bfa; --accent-ink:#140b2a; }
body[data-theme="cyan"]   { --accent:#22d3ee; --accent-ink:#04191e; }
body[data-theme="pink"]   { --accent:#f472b6; --accent-ink:#26071a; }
body[data-theme="red"]    { --accent:#f87171; --accent-ink:#260808; }

body {
  background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--bg);
  color: var(--text); font-family: "Segoe UI", Roboto, Arial, sans-serif; min-height: 100vh;
}
.hidden { display: none !important; }
h2 { font-size: 24px; } h3 { font-size: 16px; margin-bottom: 10px; }

/* ---------- АВТОРИЗАЦИЯ ---------- */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero { padding: 60px 50px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-logo { font-size: 30px; font-weight: 800; letter-spacing: 4px; color: var(--accent); }
.auth-hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.05; text-transform: uppercase; }
.auth-sub { color: var(--muted); font-size: 18px; max-width: 460px; }
.auth-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.auth-badges span { background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-size: 14px; }
.auth-card { background: var(--panel); border-left: 1px solid var(--line); padding: 46px 44px; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.auth-tabs { display: flex; background: var(--panel2); border-radius: 12px; padding: 5px; }
.at { flex: 1; padding: 11px; border: 0; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; border-radius: 9px; cursor: pointer; }
.at.active { background: var(--accent); color: var(--accent-ink); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 13px; border-radius: 10px; font-size: 15px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.form-error { color: #ff8080; font-size: 13px; min-height: 16px; }
.demo-hint { font-size: 12.5px; color: var(--muted); background: var(--panel2); padding: 10px; border-radius: 8px; text-align: center; }
.demo-hint b { color: var(--accent); }

/* ---------- КНОПКИ ---------- */
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .12s, filter .12s; font-family: inherit; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.big { padding: 14px; font-size: 16px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.danger { background: #ef4444; color: #fff; }
.btn.small { padding: 7px 11px; font-size: 13px; }

/* ---------- ПРИЛОЖЕНИЕ ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.logo { font-weight: 800; letter-spacing: 3px; color: var(--accent); font-size: 18px; }
.who { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.role-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.tabs { display: flex; gap: 6px; padding: 12px 24px 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.tab { background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--muted); padding: 11px 16px; font-size: 15px; font-weight: 700; cursor: pointer; display: flex; gap: 7px; align-items: center; font-family: inherit; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.badge { background: #ef4444; color: #fff; border-radius: 999px; font-size: 11px; padding: 2px 7px; }
main { padding: 26px 24px 60px; max-width: 1100px; margin: 0 auto; }
.view-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

/* ---------- КАРТОЧКИ ТРЕНИРОВОК ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.card .w-when { font-size: 13px; color: var(--accent); font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.card h4 { font-size: 20px; margin: 7px 0 5px; }
.card .w-muscles { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.card .w-note { font-size: 13px; background: var(--panel2); padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; }
.card .w-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.card .w-actions { display: flex; gap: 8px; }
.status { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; margin-left: 8px; }
.status.planned { background: rgba(163,230,53,.15); color: var(--accent); }
.status.done { background: rgba(34,211,238,.15); color: #22d3ee; }
.status.cancel { background: rgba(248,113,113,.15); color: #f87171; }
.empty { color: var(--muted); padding: 30px; text-align: center; background: var(--panel); border-radius: 16px; border: 1px dashed var(--line); grid-column: 1/-1; }

/* ---------- ЧАТ ---------- */
.chat-wrap { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: calc(100vh - 210px); min-height: 420px; }
.chat-people { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; overflow-y: auto; }
.dialog { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14.5px; }
.dialog:hover { background: var(--panel2); }
.dialog.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.chat-main { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.chat-title { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 800; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.35; }
.msg .t { display: block; font-size: 10.5px; opacity: .6; margin-top: 3px; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--panel2); border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }

/* ---------- ЛЮДИ ---------- */
.person { display: flex; flex-direction: column; gap: 8px; }
.person .p-name { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.person .p-meta { font-size: 13px; color: var(--muted); }
.person .p-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.blocked-tag { background: #ef4444; color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 800; }

/* ---------- НАСТРОЙКИ ---------- */
.settings-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.theme-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; background: var(--sw); cursor: pointer; transition: transform .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: #fff; transform: scale(1.12); }
.account-info { background: var(--panel2); border-radius: 10px; padding: 14px; font-size: 14px; line-height: 1.9; }

/* ---------- ТРЕНИРОВКИ / ЛЮДИ ---------- */
.date-head { grid-column: 1/-1; font-weight: 800; color: var(--accent); margin-top: 10px; font-size: 15px; letter-spacing: .3px; }
.workout { grid-column: 1/-1; display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; align-items: flex-start; }
.workout.done { opacity: .62; }
.workout.done .wtype { text-decoration: line-through; }
.wtime { font-size: 15px; font-weight: 800; background: var(--panel2); border: 1px solid var(--line); padding: 8px 10px; border-radius: 10px; color: var(--accent); min-width: 62px; text-align: center; }
.wbody { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wtype { font-weight: 800; font-size: 17px; }
.wmuscles { color: var(--muted); font-size: 14px; }
.wnote { font-size: 13px; background: var(--panel2); padding: 7px 9px; border-radius: 8px; }
.wmeta { font-size: 12px; color: var(--muted); }
.wactions { display: flex; flex-direction: column; gap: 6px; }
.person { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
.person .avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--av, var(--accent)); color: #10150a; font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.person .pinfo { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 140px; }
.person .pinfo b { font-size: 16px; }
.person .pinfo span { font-size: 12.5px; color: var(--muted); }
.person .pactions { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.person.is-blocked { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.05); }

/* ---------- МОДАЛКА / ТОСТ ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto; }
.modal-card form { display: flex; flex-direction: column; gap: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 13px 22px; border-radius: 999px; font-weight: 800; z-index: 99; box-shadow: 0 8px 30px rgba(0,0,0,.45); animation: pop .25s ease; }
@keyframes pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px 26px 10px; }
  .auth-card { border-left: 0; padding: 26px; }
  .chat-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-people { max-height: 170px; }
  .chat-messages { min-height: 300px; }
}
