:root {
  --bg: #07111f;
  --panel: #0d1b2e;
  --panel-2: #12243a;
  --card: #101f33;
  --line: #223956;
  --text: #edf6ff;
  --muted: #a7b7cc;
  --soft: #d6e2f2;
  --blue: #4cc9f0;
  --green: #54e39b;
  --yellow: #ffd166;
  --red: #ff6b7a;
  --violet: #a78bfa;
  --shadow: 0 18px 60px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(76, 201, 240, .12), transparent 32rem),
    linear-gradient(135deg, #07111f 0%, #0a1524 48%, #07111f 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.skip-link {
  position: absolute;
  left: -999px;
  top: 1rem;
  z-index: 99;
  padding: .8rem 1rem;
  background: var(--blue);
  color: #06101e;
  border-radius: .5rem;
}
.skip-link:focus { left: 1rem; }

.shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.2rem;
  border-right: 1px solid var(--line);
  background: rgba(7, 17, 31, .82);
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: .85rem; align-items: center; margin-bottom: 1.5rem; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: .5rem;
  color: #06101e;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand small, .eyebrow, .muted { color: var(--muted); }
.nav-list { display: grid; gap: .4rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .82rem .9rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  background: transparent;
  color: var(--soft);
  text-align: left;
}
.nav-item[aria-current="page"], .nav-item:hover, .nav-item:focus-visible {
  border-color: rgba(76, 201, 240, .32);
  background: rgba(76, 201, 240, .1);
  outline: none;
}
.nav-icon { width: 1.3rem; text-align: center; }
.priority-box {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(255, 209, 102, .35);
  border-radius: .5rem;
  background: rgba(255, 209, 102, .08);
}
.priority-box span { color: var(--yellow); font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.priority-box strong { display: block; margin: .45rem 0; }
.priority-box p { margin: 0; color: var(--muted); line-height: 1.5; }

.app { min-width: 0; padding: 1.4rem clamp(1rem, 3vw, 2.4rem) 2rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.4rem;
}
.eyebrow { margin: 0 0 .25rem; font-size: .78rem; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.75rem, 4vw, 3.1rem); letter-spacing: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; }
.content { display: grid; gap: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card, .stat, .question-panel {
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: linear-gradient(180deg, rgba(18, 36, 58, .95), rgba(13, 27, 46, .95));
  box-shadow: var(--shadow);
}
.card { padding: 1rem; }
.stat { padding: 1rem; min-height: 112px; }
.stat span { color: var(--muted); font-size: .86rem; }
.stat strong { display: block; margin-top: .35rem; font-size: 1.85rem; }
.stat small { color: var(--muted); }
.progress-track {
  height: .65rem;
  overflow: hidden;
  border-radius: 999px;
  background: #07111f;
  border: 1px solid var(--line);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width .25s ease;
}
.subject-card { display: grid; gap: .8rem; }
.subject-head { display: flex; justify-content: space-between; gap: .8rem; align-items: start; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: .28rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--soft);
  background: rgba(255, 255, 255, .04);
  font-size: .78rem;
  font-weight: 700;
}
.pill.high { color: #06101e; border-color: transparent; background: var(--yellow); }
.actions, .filter-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.primary-button, .ghost-button, .option-button {
  min-height: 44px;
  border-radius: .45rem;
  border: 1px solid var(--line);
  color: var(--text);
}
.primary-button {
  padding: .78rem 1rem;
  border-color: transparent;
  color: #06101e;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 800;
}
.ghost-button { padding: .7rem .9rem; background: rgba(255, 255, 255, .04); }
.ghost-button.danger { border-color: rgba(255, 107, 122, .35); color: #ffd9de; }
.ghost-button:disabled, .primary-button:disabled { opacity: .55; cursor: not-allowed; }
select, input[type="number"], textarea {
  width: 100%;
  min-height: 44px;
  padding: .7rem .8rem;
  border-radius: .45rem;
  border: 1px solid var(--line);
  background: #081525;
  color: var(--text);
}
textarea { min-height: 180px; resize: vertical; line-height: 1.55; }
.file-import {
  display: grid;
  gap: .25rem;
}
.file-import input {
  width: 100%;
  min-height: 44px;
  padding: .55rem;
  border-radius: .45rem;
  border: 1px solid var(--line);
  background: #081525;
  color: var(--text);
}
.question-panel { padding: 1rem; display: grid; gap: 1rem; }
.option-list { display: grid; gap: .65rem; }
.option-button {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: .75rem;
  align-items: center;
  width: 100%;
  padding: .8rem;
  background: rgba(255, 255, 255, .035);
  text-align: left;
}
.option-letter {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: .4rem;
  background: rgba(76, 201, 240, .12);
  color: var(--blue);
  font-weight: 800;
}
.option-button.correct { border-color: rgba(84, 227, 155, .8); background: rgba(84, 227, 155, .12); }
.option-button.wrong { border-color: rgba(255, 107, 122, .8); background: rgba(255, 107, 122, .12); }
.feedback { border-left: 4px solid var(--blue); padding: .8rem; background: rgba(76, 201, 240, .08); border-radius: .35rem; }
.daily-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: rgba(255, 255, 255, .035);
}
.daily-item input { width: 22px; height: 22px; accent-color: var(--green); flex: 0 0 auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.flashcard {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  border: 1px solid rgba(76, 201, 240, .35);
  border-radius: .5rem;
  background: rgba(76, 201, 240, .08);
  text-align: center;
}
.timer { font-size: 2.2rem; font-weight: 800; color: var(--green); }
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: 360px;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--panel-2);
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.bottom-nav { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .app { padding-bottom: 6rem; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(74px, 1fr);
    gap: .2rem;
    overflow-x: auto;
    padding: .45rem .55rem calc(.45rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(7, 17, 31, .96);
    backdrop-filter: blur(18px);
  }
  .bottom-nav .nav-item {
    justify-content: center;
    display: grid;
    gap: .16rem;
    padding: .45rem .2rem;
    min-height: 56px;
    font-size: .68rem;
    text-align: center;
  }
  .bottom-nav .nav-icon { width: auto; font-size: 1.05rem; }
}

@media (max-width: 520px) {
  .app { padding-inline: .85rem; }
  .stat strong { font-size: 1.55rem; }
  .actions > *, .filter-row > * { width: 100%; }
  .option-button { grid-template-columns: 30px 1fr; }
}
