:root {
  --bg: #101828;
  --card: #182236;
  --card2: #22304c;
  --accent: #6366f1;
  --accent2: #818cf8;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --text: #f1f5fb;
  --muted: #94a3b8;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 100% -10%, #312e8155 0%, transparent 60%),
    radial-gradient(900px 400px at -10% 110%, #0e749055 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 14px;
  min-height: 100vh;
}
header .hrow { display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 21px; margin-bottom: 2px; background: linear-gradient(90deg, #fff, #a5b4fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { color: var(--muted); font-size: 13px; }
.avatar {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 14px #6366f155;
}

.cards { display: flex; gap: 8px; margin: 14px 0; }
.card {
  background: linear-gradient(160deg, var(--card), #131c2e);
  border: 1px solid #ffffff0f;
  border-radius: var(--radius);
  padding: 12px;
}
.card.stat { flex: 1; text-align: center; padding: 12px 4px; position: relative; overflow: hidden; }
.stat-num { font-size: 20px; font-weight: 800; background: linear-gradient(90deg, var(--accent2), #38bdf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

nav { display: flex; gap: 6px; margin-bottom: 12px; background: var(--card); border-radius: 14px; padding: 4px; }
.tab {
  flex: 1; padding: 10px 4px; border: 0; border-radius: 11px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 700;
  transition: all .18s;
}
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px #6366f155; }

.day {
  background: var(--card); border-radius: var(--radius);
  padding: 11px 13px; margin-bottom: 10px;
  border-left: 3px solid var(--accent);
}
.day.today { border-left-color: var(--good); background: linear-gradient(160deg, #16233a, var(--card)); }
.day h3 { font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .8px; }
.day.today h3 { color: var(--good); }
.lesson { display: flex; align-items: center; padding: 8px 0; border-top: 1px solid #ffffff0c; }
.lesson:first-of-type { border-top: 0; }
.time { color: var(--accent2); font-weight: 700; font-size: 13px; min-width: 92px; font-variant-numeric: tabular-nums; }
.now {
  color: #fff; font-size: 10px; margin-left: 6px; font-weight: 800;
  background: var(--good); border-radius: 8px; padding: 2px 7px;
}
.past { opacity: .4; }
.subj { font-size: 15px; flex: 1; }

.dl {
  background: var(--card); border-radius: var(--radius);
  padding: 13px; margin-bottom: 9px; display: flex; justify-content: space-between; align-items: center;
  border: 1px solid #ffffff0c;
}
.dl .subj { font-weight: 700; font-size: 15px; }
.dl .task { color: var(--muted); font-size: 13px; margin-top: 2px; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge.soon { background: #f8717122; color: var(--bad); }
.badge.mid { background: #fbbf2422; color: var(--warn); }
.badge.late { background: #34d39922; color: var(--good); }
.badge.over { background: #f8717133; color: var(--bad); }

.ai-card { padding: 16px; }
.ai-card h2 { font-size: 17px; margin-bottom: 8px; }
.ai-hint { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.bal-line {
  background: linear-gradient(90deg, #6366f122, #38bdf822);
  border-radius: 12px; padding: 10px 12px;
  font-size: 13px; color: var(--accent2); font-weight: 700; margin-bottom: 12px;
  border: 1px solid #6366f133;
}
.ai-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.preset {
  background: var(--card2); color: var(--accent2); border: 1px solid #ffffff14;
  border-radius: 20px; padding: 8px 13px; font-size: 13px; font-weight: 700;
  transition: all .15s;
}
.preset:active { background: var(--accent); color: #fff; transform: scale(.96); }
#ai-input {
  width: 100%; min-height: 90px; background: var(--card2); color: var(--text);
  border: 1px solid #ffffff14; border-radius: 12px; padding: 12px;
  font-size: 15px; font-family: inherit; resize: vertical; margin-bottom: 10px;
}
button.primary {
  width: 100%; padding: 13px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff; font-size: 15px; font-weight: 800;
  box-shadow: 0 4px 14px #6366f144;
}
button.primary:active { opacity: .85; transform: scale(.98); }
.ai-note { color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center; }

/* магазин */
.shop-note { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.pack {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card2); border: 1px solid #ffffff12; border-radius: 14px;
  padding: 14px; margin-bottom: 10px; position: relative; cursor: pointer;
  transition: transform .1s;
}
.pack:active { transform: scale(.97); }
.pack.best { border-color: var(--accent); background: linear-gradient(160deg, #2a2d52, var(--card2)); }
.pack-flag {
  position: absolute; top: -9px; right: 12px;
  background: linear-gradient(90deg, var(--accent), #38bdf8); color: #fff; font-size: 10px; font-weight: 800;
  padding: 3px 9px; border-radius: 10px;
}
.pack-title { font-weight: 800; font-size: 15px; }
.pack-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pack-price { font-size: 17px; font-weight: 800; color: var(--warn); }

/* формы добавления */
.add-card { margin-bottom: 12px; padding: 14px; }
.add-title { font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.add-row { display: flex; gap: 8px; margin-bottom: 8px; }
.add-card input, .add-card select {
  flex: 1; background: var(--card2); color: var(--text);
  border: 1px solid #ffffff14; border-radius: 12px;
  padding: 11px; font-size: 14px; font-family: inherit;
  margin-bottom: 8px; min-width: 0;
}
.add-card input#nl-time { flex: 1.4; }
.add-card button.small { padding: 11px; font-size: 14px; }
.form-msg { font-size: 13px; color: var(--good); min-height: 16px; margin-top: 6px; }
.del { background: none; border: 0; opacity: .4; font-size: 15px; padding: 4px 6px; flex-shrink: 0; }
.del:active { opacity: 1; }
.ai-actions { display: flex; gap: 8px; }
.small-btn { flex: 1; padding: 12px; font-size: 14px; text-align: center; }
.photo-btn {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--card2); color: var(--accent2); border: 1px solid #ffffff14;
}
.ai-answer {
  background: linear-gradient(160deg, #1e2a44, var(--card2));
  border-radius: 12px; padding: 14px;
  margin-top: 12px; border-left: 3px solid var(--accent);
}
.answer-text { font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.copy-btn {
  margin-top: 10px; background: var(--card); color: var(--accent2);
  border: 1px solid #ffffff14; border-radius: 8px; padding: 8px 14px; font-size: 13px;
}
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.empty .big { font-size: 42px; margin-bottom: 10px; }
footer { text-align: center; color: var(--muted); font-size: 11px; padding: 16px 0 6px; }