:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #e6e8ef;
  --text: #111827;
  --muted: #6b7280;
  --muted2: #9ca3af;
  --shadow: 0 12px 28px rgba(17,24,39,0.08);
  --radius: 18px;

  --live: #eff6ff;     --liveLine: #bfdbfe;
  --module: #ecfeff;   --moduleLine: #a5f3fc;
  --project: #f0fdf4;  --projectLine: #bbf7d0;
  --bd: #fff7ed;       --bdLine: #fed7aa;

  --accent: #2563eb;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(900px 600px at 30% -10%, #dbeafe 0%, rgba(219,234,254,0) 60%),
              radial-gradient(900px 600px at 80% 0%, #dcfce7 0%, rgba(220,252,231,0) 60%),
              var(--bg);
  color: var(--text);
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(246,247,251,0.9);
  backdrop-filter: blur(10px);
}

.brand{ display:flex; align-items:center; gap: 12px; }
.mark{
  width: 42px; height:42px; border-radius: 14px;
  display:grid; place-items:center;
  font-weight: 900;
  background: #111827;
  color: white;
  letter-spacing: .6px;
}
.title{ font-weight: 800; font-size: 16px; }
.subtitle{ color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions{ display:flex; gap: 10px; }

.layout{
  max-width: 1220px;
  margin: 18px auto 0;
  padding: 0 18px 18px;
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cardhead{
  padding: 16px 16px 10px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.h{ font-weight: 900; letter-spacing: .1px; }
.p{ color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.35; }

.filters .grid{
  padding: 0 16px 16px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.field{ display:flex; flex-direction:column; gap: 6px; }
label{ font-size: 12px; color: var(--muted); font-weight: 600; }

select, input{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  background: white;
  color: var(--text);
  outline: none;
}
select:focus, input:focus{
  border-color: rgba(37,99,235,0.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
}
#typeSelect{
  min-height: 96px;
  padding: 10px;
}
.hint{ font-size: 11px; color: var(--muted2); margin-top: 6px; }

.toggles{
  display:flex; flex-direction:column; gap: 10px;
  padding-top: 2px;
}
.toggle{
  display:flex; gap: 10px; align-items:center;
  font-size: 13px; color: var(--text);
  user-select:none;
}
.toggle input{ width: 16px; height: 16px; }

.legend{
  padding: 0 16px 16px;
  display:flex; gap: 8px; flex-wrap: wrap;
}
.chip{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-weight: 700;
}
.chip.live{ background: var(--live); border-color: var(--liveLine); }
.chip.module{ background: var(--module); border-color: var(--moduleLine); }
.chip.project{ background: var(--project); border-color: var(--projectLine); }
.chip.bd{ background: var(--bd); border-color: var(--bdLine); }

.board{ overflow:hidden; }
.boardhead .nav{ display:flex; gap: 10px; }

.btn{
  border: 1px solid var(--line);
  background: #111827;
  color: white;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 800;
  cursor:pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:hover{ transform: translateY(-1px); opacity: .95; }
.btn:active{ transform: translateY(0); }
.btn.ghost{
  background: white;
  color: var(--text);
}

.iconbtn{
  width: 40px; height: 40px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  cursor:pointer;
  font-weight: 900;
}
.iconbtn:hover{ background: #f9fafb; }

/* Month Grid */
.cal{
  border-top: 1px solid var(--line);
}
.calhead{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 12px 14px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}
.calhead div{
  text-align:center;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .10em;
  font-weight: 800;
}
.grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
}
.day{
  min-height: 116px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
}
.day:nth-child(7n){ border-right:none; }
.day.muted{ background: #fbfbfd; color: var(--muted2); }
.dtop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.count{
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #ffffff;
}
.items{ margin-top: 10px; display:flex; flex-direction:column; gap: 8px; }

.item{
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.item:hover{ transform: translateY(-1px); box-shadow: 0 10px 18px rgba(17,24,39,0.06); }
.ititle{ font-weight: 900; font-size: 12px; }
.imeta{ font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; }

.item.live{ background: var(--live); border-color: var(--liveLine); }
.item.module{ background: var(--module); border-color: var(--moduleLine); }
.item.project{ background: var(--project); border-color: var(--projectLine); }
.item.bd{ background: var(--bd); border-color: var(--bdLine); }

/* Timeline */
.timeline{
  padding: 14px 14px 16px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.weekcard{
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #ffffff;
}
.weekhead{
  display:flex; align-items:flex-start; justify-content:space-between; gap: 10px;
  margin-bottom: 10px;
}
.wtitle{ font-weight: 900; }
.wsub{ color: var(--muted); font-size: 12px; margin-top: 3px; }
.wrange{ font-size: 12px; color: var(--muted); font-weight: 700; }
.rows{ display:flex; flex-direction:column; gap: 10px; }
.row{
  display:grid;
  grid-template-columns: 130px 1fr 140px;
  gap: 12px;
  align-items:center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fcfcfe;
}
.rwhen{ font-weight: 900; font-size: 13px; }
.rwhat{ font-weight: 900; }
.rnote{ font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.rtime{ text-align:right; font-weight: 900; }
.smallchip{
  display:inline-block;
  margin-top: 6px;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}
.smallchip.module{ background: var(--module); border-color: var(--moduleLine); }
.smallchip.live{ background: var(--live); border-color: var(--liveLine); }
.smallchip.project{ background: var(--project); border-color: var(--projectLine); }
.smallchip.bd{ background: var(--bd); border-color: var(--bdLine); }

/* Agenda */
.agenda{
  padding: 14px 14px 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.arow{
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display:grid;
  grid-template-columns: 150px 1fr 160px;
  gap: 12px;
  align-items:center;
  background: white;
  cursor:pointer;
}
.arow:hover{ box-shadow: 0 10px 18px rgba(17,24,39,0.06); transform: translateY(-1px); }
.adate{ font-weight: 900; }
.atitle{ font-weight: 900; }
.asub{ font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.atime{ text-align:right; font-weight: 900; }
.flex{
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 6px;
}

.footer{
  max-width: 1220px;
  margin: 8px auto 18px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 12px;
}

/* Modal */
.modal{ position: fixed; inset: 0; display:none; align-items:center; justify-content:center; padding: 18px; z-index: 50; }
.modal.show{ display:flex; }
.backdrop{ position:absolute; inset:0; background: rgba(17,24,39,0.55); backdrop-filter: blur(6px); }
.modalcard{
  position: relative;
  width: min(720px, 96vw);
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modalhead{
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  display:flex; align-items:flex-start; justify-content:space-between; gap: 10px;
}
.mtitle{ font-weight: 900; font-size: 16px; }
.msub{ color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 600; }
.modalbody{ padding: 14px; }
.kv{ display:grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eef0f6; }
.kv:last-child{ border-bottom:none; }
.k{ color: var(--muted); font-size: 12px; font-weight: 800; }
.v{ font-weight: 800; }
.modalfoot{
  padding: 14px;
  border-top: 1px solid var(--line);
  display:flex; justify-content:flex-end; gap: 10px;
}

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .row{ grid-template-columns: 1fr; }
  .arow{ grid-template-columns: 1fr; }
  .atime{ text-align:left; }
}
