:root {
  --bg: #0b1020;
  --card: #121a33;
  --card-2: #16203f;
  --line: #263259;
  --text: #e9edff;
  --muted: #93a0c8;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --bad: #f87171;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 15% -10%, #1e1b4b 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 20%, #0e3a52 0%, transparent 55%),
    var(--bg);
}

.bg-bubbles { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg-bubbles span {
  position: absolute;
  bottom: -120px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0.10;
  animation: rise 16s linear infinite;
}
.bg-bubbles span:nth-child(1) { left: 6%;  animation-delay: 0s; }
.bg-bubbles span:nth-child(2) { left: 28%; animation-delay: 3s; width: 120px; height: 120px; }
.bg-bubbles span:nth-child(3) { left: 52%; animation-delay: 6s; }
.bg-bubbles span:nth-child(4) { left: 72%; animation-delay: 9s;  width: 140px; height: 140px; }
.bg-bubbles span:nth-child(5) { left: 88%; animation-delay: 12s; }
@keyframes rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  15%  { opacity: 0.14; }
  100% { transform: translateY(-115vh) scale(1.2); opacity: 0; }
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 60px;
}

/* ---------- КАРТОЧКА ВХОДА ---------- */
.card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: pop 0.35s ease;
}
@keyframes pop { from { transform: translateY(14px); opacity: 0; } }

.card__logo { width: 76px; height: 76px; object-fit: contain; filter: drop-shadow(0 6px 18px rgba(124, 92, 255, 0.5)); }
.card__brand { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent-2); margin: 8px 0 4px; }
.card__title { margin: 6px 0 8px; font-size: 30px; line-height: 1.15; }
.accent { color: var(--accent-2); }
.card__lead { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.card__foot { margin: 16px 0 0; color: var(--muted); font-size: 12.5px; text-align: center; }

.form__label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form__input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #0d1430;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form__input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18); }
.form__hint {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
.form__hint.is-ok { color: var(--ok); }
.form__hint.is-bad { color: var(--bad); }
.form__counter { font-family: monospace; color: var(--muted); }
.form__row { margin-top: 16px; }
.form__error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--bad);
  font-size: 14px;
}
.is-invalid { animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ---------- КНОПКИ ---------- */
.btn {
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, filter 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0b1020; }
.btn--primary:hover { filter: brightness(1.1); }
.btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn--small { width: auto; margin: 0; padding: 9px 14px; font-size: 14px; }
.btn--accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0b1020; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn__spinner {
  display: none;
  width: 16px; height: 16px;
  border: 3px solid rgba(11, 16, 32, 0.3);
  border-top-color: #0b1020;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.7s linear infinite;
}
.is-loading .btn__text { display: none; }
.is-loading .btn__spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ПРИЛОЖЕНИЕ ---------- */
.app { width: min(1080px, 100%); animation: pop 0.35s ease; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.topbar__me { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1020;
}
.topbar__hi { font-size: 17px; }
.topbar__sub { font-size: 12.5px; color: var(--muted); }
.topbar__actions { display: flex; gap: 10px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.wcard {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 150px;
}
.wcard__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.wcard--wide { grid-column: 1 / -1; }

/* Погода */
.weather__row { display: flex; align-items: center; gap: 12px; }
.weather__icon { font-size: 44px; }
.weather__temp { font-size: 34px; font-weight: 800; }
.weather__desc { color: var(--muted); font-size: 14px; }
.weather__city { color: var(--accent-2); font-size: 13px; }
.weather__wind { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Часы */
.clock__time { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.clock__date { color: var(--muted); text-transform: capitalize; }

/* Таймер */
.timer__display { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.chips { display: flex; gap: 8px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0d1430;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.chip.is-active { background: rgba(124, 92, 255, 0.25); border-color: var(--accent); color: var(--text); }
.timer__btns { display: flex; gap: 8px; }
.timer__btns .btn { margin-top: 0; padding: 10px; font-size: 14px; }

/* Заметки */
.note__box {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  background: #0d1430;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.note__box:focus { border-color: var(--accent); }
.note__status { font-size: 12px; color: var(--ok); }

/* Статистика */
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 90px;
  background: #0d1430;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}
.stat__value { font-size: 26px; font-weight: 800; color: var(--accent-2); }
.stat__label { font-size: 11.5px; color: var(--muted); }

/* ---------- АДМИН-ПАНЕЛЬ ---------- */
.admin {
  margin-top: 18px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  padding: 18px;
  animation: pop 0.3s ease;
}
.admin__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.admin__title { margin: 0; font-size: 20px; }
.admin__title span { color: var(--bad); }
.admin__actions { display: flex; gap: 8px; }
.admin__section { margin-top: 16px; }
.admin__label { font-size: 12.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.table tr.is-blocked td { opacity: 0.65; }
.table-loading { color: var(--muted); font-size: 14px; padding: 8px 0; }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
}
.pill--ok { background: rgba(52, 211, 153, 0.15); color: var(--ok); border-color: rgba(52, 211, 153, 0.4); }
.pill--bad { background: rgba(248, 113, 113, 0.15); color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }
.pill--admin { background: rgba(124, 92, 255, 0.2); color: #c4b5fd; border-color: rgba(124, 92, 255, 0.5); }
.pill--me { background: rgba(34, 211, 238, 0.15); color: var(--accent-2); border-color: rgba(34, 211, 238, 0.4); }
.pill--style { background: rgba(255, 255, 255, 0.06); color: var(--text); border-color: var(--line); }

.btn-mini {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid;
  background: transparent;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-mini--bad { color: var(--bad); border-color: rgba(248, 113, 113, 0.5); }
.btn-mini--bad:hover { background: rgba(248, 113, 113, 0.15); }
.btn-mini--ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.5); }
.btn-mini--ok:hover { background: rgba(52, 211, 153, 0.15); }

.feed { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.feed__item {
  display: grid;
  grid-template-columns: 150px 130px 1fr;
  gap: 8px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.feed__time { color: var(--muted); font-family: monospace; }
.feed__user { color: var(--accent-2); font-weight: 700; }
.feed__act { color: var(--text); }
@media (max-width: 640px) {
  .feed__item { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- ТОСТ ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #0d1430;
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14.5px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  z-index: 50;
  animation: pop 0.25s ease;
}

/* ---------- стили под актуальную разметку ---------- */
.form__pass { margin-top: 14px; }

.wcard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.wcard__tag { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--ok); }

.iconbtn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d1430;
  color: var(--accent-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.3s, background 0.2s;
}
.iconbtn:hover { background: rgba(34, 211, 238, 0.15); transform: rotate(180deg); }

.weather { display: flex; align-items: center; gap: 14px; }
.weather__icon { font-size: 46px; }
.weather__temp { font-size: 32px; font-weight: 800; }
.weather__desc { color: var(--muted); font-size: 14px; }
.weather__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.weather__meta span:last-child { color: var(--accent-2); }

.clock { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.clock__date { color: var(--muted); text-transform: capitalize; margin-top: 4px; }

.timer { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.timer__presets { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0d1430;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.chip.is-active { background: rgba(124, 92, 255, 0.25); border-color: var(--accent); color: var(--text); }
.timer__actions { display: flex; gap: 8px; }
.timer__actions .btn { margin-top: 0; }

.notes {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  background: #0d1430;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.notes:focus { border-color: var(--accent); }

.stats__foot { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

.topbar__who { display: flex; flex-direction: column; }
.topbar__role { font-size: 12.5px; color: var(--muted); }

.admin__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.admin__box {
  background: #0d1430;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  overflow-x: auto;
}
.admin__title { font-size: 14.5px; font-weight: 700; margin-bottom: 8px; }
.admin__hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.admin__feed { max-height: 340px; overflow-y: auto; }
.admin__filter {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1430;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.admin__filter:focus { border-color: var(--accent); }
.admin__list .table { min-width: 520px; }
.admin h2 { font-size: 20px; margin: 0; }

[hidden] { display: none !important; }

/* ---------- ИНДИВИДУАЛЬНЫЕ СТИЛИ ПОЛЬЗОВАТЕЛЕЙ ---------- */
body { transition: background 0.5s ease; }

body.theme-sun {
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(255, 214, 51, 0.35), transparent 60%),
    linear-gradient(160deg, #3a2f04 0%, #14120a 55%, #0b1020 100%);
  --accent: #ffd633;
  --accent-2: #ff9e2c;
}
body.theme-mars {
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255, 84, 64, 0.4), transparent 60%),
    linear-gradient(160deg, #3d0d0d 0%, #1a0b0f 55%, #0b1020 100%);
  --accent: #ff5440;
  --accent-2: #ff9e2c;
}
body.theme-ocean {
  background:
    radial-gradient(900px 500px at 110% 10%, rgba(34, 211, 238, 0.3), transparent 60%),
    linear-gradient(160deg, #062c3f 0%, #0a1730 55%, #0b1020 100%);
  --accent: #22d3ee;
  --accent-2: #60a5fa;
}
body.theme-forest {
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(52, 211, 153, 0.3), transparent 60%),
    linear-gradient(160deg, #06301f 0%, #0a1a17 55%, #0b1020 100%);
  --accent: #34d399;
  --accent-2: #a3e635;
}
body.theme-violet {
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(167, 139, 250, 0.35), transparent 60%),
    linear-gradient(160deg, #241349 0%, #130f2b 55%, #0b1020 100%);
  --accent: #a78bfa;
  --accent-2: #f472b6;
}

/* карточка «Мой стиль» */
.style__current { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.style__picker { display: flex; flex-wrap: wrap; gap: 8px; }
.style__hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
.swatch {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0d1430;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.swatch:hover { transform: translateY(-2px); }
.swatch.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }
.swatch__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}
.swatch__dot.theme-sun    { background: linear-gradient(135deg, #ffd633, #ff9e2c); }
.swatch__dot.theme-mars   { background: linear-gradient(135deg, #ff5440, #7c1d1d); }
.swatch__dot.theme-ocean  { background: linear-gradient(135deg, #22d3ee, #2563eb); }
.swatch__dot.theme-forest { background: linear-gradient(135deg, #34d399, #65a30d); }
.swatch__dot.theme-violet { background: linear-gradient(135deg, #a78bfa, #f472b6); }

/* виджет быстрого поиска */
.glinks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.glink {
  display: block;
  text-align: center;
  padding: 11px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1430;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s, border-color 0.2s;
}
.glink:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
