:root {
  --milk: #f3efe8;
  --ink: #1d2430;
  --muted: #6e7886;
  --blue: #2f7bff;
  --blue-deep: #1d5ed8;
  --blue-soft: rgba(47, 123, 255, 0.12);
  --card: rgba(255, 252, 248, 0.82);
  --line: rgba(255, 255, 255, 0.92);
  --ok: #1f9d55;
  --warn: #d98318;
  --danger: #d64545;
  --shadow: 0 16px 40px rgba(70, 88, 112, 0.1);
  --font: "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  background: #f3efe8;
}
button, input, textarea, select { font: inherit; color: inherit; }
button {
  appearance: none; cursor: pointer; border: 0; background: transparent;
  height: 36px; padding: 0 14px; border-radius: 10px;
  font-size: 14px; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap;
}
a { color: var(--blue-deep); text-decoration: none; }
.hidden { display: none !important; }

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 216px; flex-shrink: 0; padding: 18px 12px 14px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  background: #fffdfb;
  border-right: 1px solid #b7aa9c;
  box-shadow: 1px 0 0 #b7aa9c;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 8px 12px; margin-bottom: 6px;
  font-weight: 700; font-size: 15px;
}
.brand i {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--blue); color: white;
  font-style: normal; font-weight: 700; font-size: 14px;
}
.nav-item {
  width: 100%; height: 40px; justify-content: flex-start;
  padding: 0 12px; border-radius: 10px;
  color: #5e6773; font-weight: 600;
}
.nav-item.active { background: #e7f0ff; color: var(--blue-deep); }
.nav-item:hover { background: #f3eee7; color: var(--ink); }
.nav-item.active:hover { background: #e7f0ff; color: var(--blue-deep); }
.sidebar-foot {
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid #efe8df;
  display: flex; flex-direction: column; gap: 2px;
}
.who { font-size: 13px; color: var(--muted); padding: 8px 12px 0; }
#logout { width: 100%; justify-content: flex-start; padding: 0 12px; color: var(--muted); height: 40px; }

.main {
  flex: 1; min-width: 0;
  margin: 0;
  padding: 22px 24px 40px;
  background: #f3efe8;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.glass, .task-card {
  background: #fffdfb;
  border: 1px solid #efe8df;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(70, 58, 40, 0.04);
}
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 36px; margin-bottom: 16px;
}
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-head .actions, .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

button.primary, .btn {
  background: var(--blue); color: #fff;
}
button.primary:hover, .btn:hover { background: var(--blue-deep); }
.btn.secondary, button.secondary {
  background: #fffdfb; color: var(--ink); border: 1px solid #e6dfd6;
}
.btn.secondary:hover, button.secondary:hover { background: #f6f1ea; }
.btn.ghost, button.ghost { background: transparent; color: var(--muted); }
.btn.danger, button.danger { background: #e25b5b; color: #fff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
a.btn { height: 36px; display: inline-flex; align-items: center; }

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 18px; padding: 8px;
  background: #fffdfb; border: 1px solid #efe8df; border-radius: 14px;
}
.chip, .filters input, .filters select {
  border: 0; background: transparent; border-radius: 10px;
  height: 36px; padding: 0 12px; box-shadow: none;
}
.chip.on { background: var(--blue); color: #fff; }
.chip:hover { background: #f3eee7; }
.chip.on:hover { background: var(--blue-deep); color: #fff; }
.filters input {
  width: 168px; outline: none; background: #f6f2eb; margin-left: auto;
}

.board { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.group-title { margin: 8px 2px; font-size: 13px; color: var(--muted); font-weight: 700; }

.task-card {
  padding: 16px; text-align: left; width: 100%; display: block; color: inherit;
  position: relative; overflow: hidden;
  animation: rise .35s ease both;
}
.task-card:hover { transform: translateY(-2px); }
.task-card .course { color: var(--blue-deep); font-size: 12px; font-weight: 750; }
.task-card h3 { margin: 6px 0 2px; font-size: 20px; letter-spacing: -0.03em; }
.task-card .sub { color: var(--muted); font-size: 13px; min-height: 18px; }
.task-card .desc {
  margin: 10px 0 0; color: #314054; font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.badge {
  border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,0.7); color: var(--muted);
}
.badge.open { background: #fff4e5; color: var(--warn); }
.badge.done { background: #e8f8ee; color: var(--ok); }
.badge.returned { background: #fdecec; color: var(--danger); }
.check {
  position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid #c9d4e4; background: white;
}
.task-card.picked .check { background: var(--blue); border-color: var(--blue); }
.task-card.picked .check:after { content: ""; display: block; width: 6px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(40deg); margin: 2px auto; }

.day-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.column h2 { margin: 0 0 10px; font-size: 16px; }
.count { color: var(--blue); }

.cal { padding: 14px; }
.cal-head, .cal-week, .cal-grid { display: grid; gap: 6px; }
.cal-head { grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 10px; }
.cal-head strong { text-align: center; }
.cal-nav, .cal-clear { background: transparent; color: var(--blue-deep); font-weight: 600; height: 32px; padding: 0 8px; box-shadow: none; }
.cal-week { grid-template-columns: repeat(7, 1fr); color: var(--muted); font-size: 12px; text-align: center; }
.cal-grid { grid-template-columns: repeat(7, 1fr); }
.cal-day, .cal-empty { height: 36px; border-radius: 12px; }
.cal-day { background: transparent; color: var(--ink); font-weight: 600; padding: 0; box-shadow: none; }
.cal-day:hover { background: rgba(47,123,255,0.1); }
.cal-day.on { background: var(--blue); color: white; box-shadow: 0 6px 14px rgba(47,123,255,0.28); }
.cal-clear { width: 100%; margin-top: 8px; }

.modal-bg {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(44, 52, 64, 0.28); padding: 18px; z-index: 20;
}
.modal-bg.show { display: flex; }
.modal { width: min(860px, 100%); max-height: 92vh; overflow: auto; padding: 22px; }
.modal h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.03em; }
.path { color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.desc-block { font-size: 16px; line-height: 1.6; margin: 8px 0 12px; }
.note { color: var(--muted); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 0; border-radius: 14px; background: rgba(255,255,255,0.76);
  box-shadow: inset 0 0 0 1px rgba(210, 218, 228, 0.9); padding: 10px 12px; outline: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .actions { margin-top: 14px; }
.drop {
  border-radius: 16px; padding: 16px; text-align: center; color: var(--muted);
  background: rgba(47,123,255,0.06); box-shadow: inset 0 0 0 1.5px rgba(47,123,255,0.25);
}
.drop.drag { background: rgba(47,123,255,0.14); }
.shots { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.shots img { width: 84px; height: 84px; object-fit: cover; border-radius: 14px; background: white; }
.file-row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(120,136,156,0.15); }
.banner { padding: 12px 14px; border-radius: 16px; background: #fff1f1; color: #9d2c2c; margin: 8px 0 12px; }
.empty { padding: 28px 8px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: #1d2430; color: white; border-radius: 999px; padding: 10px 16px;
  opacity: 0; pointer-events: none; transition: .2s ease; z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
.select-bar {
  position: sticky; bottom: 12px; margin-top: 16px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(420px, 100%); padding: 28px; }
.login-box h1 { margin: 0 0 18px; display: flex; gap: 10px; align-items: center; }
.login-box button { width: 100%; margin-top: 6px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: relative; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; box-shadow: none; border-bottom: 1px solid #b7aa9c; }
  .sidebar-foot { margin-top: 0; flex-direction: row; align-items: center; border-top: 0; padding-top: 0; }
  .main { margin: 0; }
  .board, .day-columns, .split { grid-template-columns: 1fr; }
  .filters input { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .task-card { animation: none; }
}
