:root {
  --bg: #f6f2e9;
  --surface: #fffdf7;
  --surface-soft: #edf5e1;
  --surface-blue: #eef6f8;
  --surface-lavender: #f3f0fa;
  --text: #2f3a33;
  --muted: #66736b;
  --line: #dfe7d7;
  --brand: #7aa874;
  --brand-dark: #4f6f52;
  --brand-soft: #d7e8ba;
  --accent: #6f93a6;
  --warning: #d9a441;
  --danger: #c96c6c;
  --done: #6fa878;
  --todo: #9aa5a0;
  --doing: #7f9db4;
  --review: #b49bd0;
  --shadow: 0 16px 45px rgba(66, 85, 64, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(215, 232, 186, .55), transparent 34%),
    radial-gradient(circle at top right, rgba(238, 246, 248, .9), transparent 28%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }

.app-shell { min-height: 100vh; }
.layout {
  display: grid;
  grid-template-columns: 285px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  background: rgba(255, 253, 247, .82);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
}
.logo-card {
  padding: 18px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #fffdf7, #edf5e1);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.logo-row { display: flex; gap: 12px; align-items: center; }
.logo-mark {
  width: 46px; height: 46px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--brand);
  color: white;
  font-weight: 900;
  font-size: 22px;
}
.logo-title { font-weight: 850; font-size: 20px; line-height: 1.1; }
.logo-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.profile-pill {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(122, 168, 116, .14);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.nav { display: grid; gap: 8px; margin-top: 16px; }
.nav button {
  border: 0;
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  transition: .18s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav button:hover { background: rgba(122, 168, 116, .12); color: var(--text); }
.nav button.active {
  background: var(--brand-dark);
  color: white;
  box-shadow: 0 12px 26px rgba(79, 111, 82, .18);
}
.nav small { margin-left: auto; opacity: .72; }
.main {
  padding: 26px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
.eyebrow {
  color: var(--brand-dark);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 44px); line-height: 1.05; }
h2 { margin-bottom: 12px; font-size: 24px; }
h3 { margin-bottom: 10px; font-size: 18px; }
.muted { color: var(--muted); }
.help-text { color: var(--muted); font-size: 13px; line-height: 1.5; }
.grid { display: grid; gap: 16px; }
.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 {
  background: rgba(255, 253, 247, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.soft { background: linear-gradient(135deg, #fffdf7, #edf5e1); }
.card.blue { background: linear-gradient(135deg, #fffdf7, #eef6f8); }
.card.lavender { background: linear-gradient(135deg, #fffdf7, #f3f0fa); }
.card.compact { padding: 14px; border-radius: var(--radius-lg); box-shadow: none; }
.kpi {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .54);
}
.kpi-value { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.form-row { display: grid; gap: 10px; margin-bottom: 12px; }
.form-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { font-weight: 750; font-size: 13px; color: var(--text); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--text);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(122, 168, 116, .16);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  border: 0;
  padding: 11px 14px;
  border-radius: 999px;
  background: var(--brand-dark);
  color: white;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: .16s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79,111,82,.18); }
.btn.secondary { background: #eef6f8; color: #385b65; }
.btn.ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--line); }
.btn.warn { background: var(--warning); color: #3f3219; }
.btn.danger { background: var(--danger); }
.btn.tiny { padding: 7px 10px; font-size: 12px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(122,168,116,.13);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}
.tag.gray { background: #eef0ee; color: #68736d; }
.tag.blue { background: #e8f2f7; color: #426b7a; }
.tag.yellow { background: #f7ecd0; color: #80611b; }
.tag.green { background: #e6f3e6; color: #47704b; }
.tag.red { background: #f6e2e2; color: #8a4242; }
.tag.purple { background: #ede7f5; color: #66507e; }
.list { display: grid; gap: 10px; }
.item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.58);
}
.item-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.item-title { font-weight: 850; }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.item-line { height: 8px; border-radius: 999px; background: #e9eee6; overflow: hidden; margin-top: 10px; }
.item-line > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.priority-row { display: grid; grid-template-columns: 1fr 90px; gap: 12px; align-items: center; }
.priority-bar { height: 12px; border-radius: 999px; background: #e9eee6; overflow: hidden; }
.priority-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-soft), var(--brand-dark)); }
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.day-card {
  min-height: 180px;
  border-radius: 20px;
  padding: 12px;
  background: rgba(255,255,255,.58);
  border: 1px solid var(--line);
}
.day-title { font-weight: 900; margin-bottom: 10px; }
.event-chip {
  padding: 8px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  border-left: 5px solid var(--todo);
  background: #f7f8f4;
}
.event-chip.done { border-left-color: var(--done); background: #eef8ee; }
.event-chip.doing { border-left-color: var(--doing); background: #eef6f8; }
.event-chip.review { border-left-color: var(--review); background: #f4eef8; }
.event-chip.missed { border-left-color: var(--danger); background: #f8eeee; }
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
}
.kanban-col {
  background: rgba(255,255,255,.5);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px;
  min-height: 220px;
}
.kanban-title { font-weight: 900; margin-bottom: 12px; }
.task-card {
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}
.timer-face {
  display: grid;
  place-items: center;
  width: min(100%, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 10px auto 18px;
  background:
    radial-gradient(circle at center, #fffdf7 0 55%, transparent 56%),
    conic-gradient(var(--brand) var(--progress, 0%), #e4eadf 0);
  box-shadow: inset 0 0 0 12px rgba(255,255,255,.8), var(--shadow);
}
.timer-time { font-size: clamp(42px, 8vw, 72px); font-weight: 950; letter-spacing: -0.05em; }
.timer-label { text-align: center; color: var(--muted); font-weight: 750; margin-top: 6px; }
.nozero-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; }
.nozero-btn {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.66);
  color: var(--text);
  font-weight: 850;
  text-align: left;
}
.nozero-btn.done { background: #e6f3e6; border-color: #b7d7b7; }
.flashcard {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(135deg, #fffdf7, #eef6f8);
  font-size: 20px;
  font-weight: 850;
}
.score-choice {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  margin-top: 8px;
  background: #fffefa;
  color: var(--text);
}
.score-choice:hover { border-color: var(--brand); background: #f8fbf2; }
.hidden { display: none !important; }
.empty {
  padding: 22px;
  border: 1px dashed #bfd2b7;
  border-radius: 22px;
  color: var(--muted);
  background: rgba(255,255,255,.45);
}
hr.soft-line { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  background: #2f3a33;
  color: white;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: fadeup .24s ease;
}
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }


/* ===== Layout utilities =====
   These replace repeated fixed inline styles that were generated in app.js.
   Dynamic values (for example progress-bar widths and subject colors) remain
   controlled by JavaScript because their values depend on app data. */
.content-narrow { max-width: 1080px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mt-28 { margin-top: 28px; }
.mb-16 { margin-bottom: 16px; }
.justify-center { justify-content: center; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 18px; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .form-row.two, .form-row.three { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .kanban { grid-template-columns: 1fr; }
  .nozero-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .nav { grid-template-columns: 1fr; }
  .sidebar { padding: 16px 12px; }
  .main { padding: 14px; }
  .card { padding: 16px; border-radius: 22px; }
  .nozero-grid { grid-template-columns: 1fr; }
  .actions { align-items: stretch; }
  .btn { justify-content: center; width: 100%; }
}

@media print {
  body { background: white; }
  .sidebar, .topbar .actions, .no-print, .btn { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
}

.attachment-box {
  border: 1px dashed rgba(122, 168, 116, .45);
  background: rgba(237, 245, 225, .42);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 12px;
}
.attachment-title {
  font-weight: 850;
  margin-bottom: 4px;
  color: var(--brand-dark);
}
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .86);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.attachment-chip span {
  color: var(--muted);
  font-weight: 700;
}
.attachment-chip:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 18px rgba(79,111,82,.12);
}

/* Enhanced capstone research components */
.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Study Mind Map and Coding Workspace additions */
.mindmap-sample, .mindmap-tree { padding: 12px; border-radius: 18px; background: rgba(255,255,255,0.65); border: 1px solid rgba(53,94,59,0.12); }
.map-children { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.map-children.small { padding-left: 18px; }
.map-line { margin: 7px 0; }
.map-line.level-1 { padding-left: 24px; }
.map-line.level-2 { padding-left: 48px; }
.map-line.level-3 { padding-left: 72px; }
.map-line.level-4 { padding-left: 96px; }
.map-node { display: inline-block; padding: 8px 12px; border-radius: 999px; background: #fff4cc; border: 1px solid rgba(0,0,0,0.08); font-weight: 700; font-size: 13px; }
.map-node.root { background: #ddeee3; color: #254c2c; }
.map-node.mastered { background: #ddefe3; color: #254c2c; }
.map-node.review { background: #fff4cc; color: #7a5b00; }
.map-node.weak { background: #fbe3de; color: #8a2d21; }
.code-input { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-card { overflow: hidden; }
.code-block { margin: 12px 0 0; padding: 14px; border-radius: 16px; background: #1f2937; color: #f9fafb; overflow-x: auto; font-size: 13px; line-height: 1.45; }
.code-note { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: #f8f6f0; color: #344; }

/* Modern responsive sidebar: desktop collapse + mobile drawer */
body { overflow-x: hidden; }
.layout {
  transition: grid-template-columns .22s ease;
}
.sidebar {
  z-index: 30;
  transition: width .22s ease, transform .22s ease, padding .22s ease;
}
.sidebar-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(47,58,51,.92);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  margin-left: auto;
  margin-bottom: 12px;
  box-shadow: 0 12px 25px rgba(47,58,51,.16);
}
.sidebar-toggle:hover { transform: translateY(-1px); }
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 45;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: rgba(47,58,51,.94);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 14px 28px rgba(47,58,51,.22);
}
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22,31,25,.42);
  backdrop-filter: blur(2px);
  z-index: 25;
}
.layout.is-collapsed {
  grid-template-columns: 96px 1fr;
}
.layout.is-collapsed .sidebar {
  padding: 18px 14px;
}
.layout.is-collapsed .logo-card {
  padding: 12px;
  border-radius: 22px;
}
.layout.is-collapsed .logo-row {
  justify-content: center;
}
.layout.is-collapsed .logo-text,
.layout.is-collapsed .profile-pill,
.layout.is-collapsed .nav-label,
.layout.is-collapsed .nav small {
  display: none;
}
.layout.is-collapsed .logo-mark {
  width: 48px;
  height: 48px;
}
.layout.is-collapsed .nav button {
  justify-content: center;
  padding: 13px;
  border-radius: 18px;
  position: relative;
}
.layout.is-collapsed .nav-icon {
  font-size: 21px;
  line-height: 1;
}
.layout.is-collapsed .nav button:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: rgba(47,58,51,.95);
  color: white;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 25px rgba(47,58,51,.2);
  pointer-events: none;
}
.layout.is-collapsed .sidebar-toggle {
  margin-left: auto;
  margin-right: auto;
}

/* Better touch and phone layout */
@media (max-width: 980px) {
  .layout,
  .layout.is-collapsed {
    display: block;
    grid-template-columns: 1fr;
  }
  .mobile-menu-btn { display: grid; place-items: center; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 330px);
    height: 100dvh;
    padding: 18px 16px;
    transform: translateX(-105%);
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 18px 0 45px rgba(47,58,51,.18);
  }
  .layout.mobile-open .sidebar {
    transform: translateX(0);
  }
  .layout.mobile-open .sidebar-scrim {
    display: block;
  }
  .layout.is-collapsed .logo-text,
  .layout.is-collapsed .profile-pill,
  .layout.is-collapsed .nav-label {
    display: block;
  }
  .layout.is-collapsed .nav button {
    justify-content: flex-start;
  }
  .layout.is-collapsed .nav button:hover::after { display: none; }
  .sidebar-toggle { display: none; }
  .nav {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 160px);
    overflow-y: auto;
    padding-right: 2px;
  }
  .nav button {
    min-height: 48px;
    font-size: 15px;
  }
  .main {
    padding: 76px 14px 18px;
    max-width: 100%;
  }
  .topbar {
    gap: 10px;
    margin-bottom: 14px;
  }
  h1 { font-size: clamp(28px, 9vw, 38px); }
  h2 { font-size: 21px; }
  .week-grid {
    grid-template-columns: repeat(7, minmax(210px, 1fr));
    margin-left: -2px;
    margin-right: -2px;
    padding: 0 2px 8px;
  }
  .kanban {
    grid-template-columns: repeat(4, minmax(250px, 1fr));
  }
  .card {
    box-shadow: 0 10px 28px rgba(66,85,64,.10);
  }
}

@media (max-width: 560px) {
  .main { padding-left: 10px; padding-right: 10px; }
  .mobile-menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 15px;
  }
  .sidebar { width: min(90vw, 315px); }
  .logo-card { margin-top: 4px; }
  .item-head { flex-direction: column; }
  .priority-row { grid-template-columns: 1fr; }
  .flashcard { min-height: 160px; padding: 20px; font-size: 18px; }
  .timer-face { width: min(100%, 260px); }
  input, textarea, select { font-size: 16px; } /* prevents iOS zoom */
  .map-line.level-1 { padding-left: 14px; }
  .map-line.level-2 { padding-left: 28px; }
  .map-line.level-3 { padding-left: 42px; }
  .map-line.level-4 { padding-left: 56px; }
  .code-block { font-size: 12px; }
}
